0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BSplCLib / BSplCLib.hxx
1 // Created on: 1991-08-09
2 // Created by: Jean Claude VAUTHIER
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _BSplCLib_HeaderFile
18 #define _BSplCLib_HeaderFile
19
20 #include <BSplCLib_EvaluatorFunction.hxx>
21 #include <BSplCLib_KnotDistribution.hxx>
22 #include <BSplCLib_MultDistribution.hxx>
23 #include <GeomAbs_BSplKnotDistribution.hxx>
24 #include <Standard.hxx>
25 #include <Standard_DefineAlloc.hxx>
26 #include <Standard_Handle.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Real.hxx>
29 #include <TColgp_Array1OfPnt.hxx>
30 #include <TColgp_Array1OfPnt2d.hxx>
31 #include <TColStd_Array1OfReal.hxx>
32 #include <TColStd_Array2OfReal.hxx>
33 #include <TColStd_HArray1OfInteger.hxx>
34 #include <TColStd_HArray1OfReal.hxx>
35
36 class gp_Pnt;
37 class gp_Pnt2d;
38 class gp_Vec;
39 class gp_Vec2d;
40 class math_Matrix;
41
42
43 //! BSplCLib   B-spline curve Library.
44 //!
45 //! The BSplCLib package is  a basic library  for BSplines. It
46 //! provides three categories of functions.
47 //!
48 //! * Management methods to  process knots and multiplicities.
49 //!
50 //! * Multi-Dimensions  spline methods.  BSpline methods where
51 //! poles have an arbitrary number of dimensions. They divides
52 //! in two groups :
53 //!
54 //! - Global methods modifying the  whole set of  poles. The
55 //! poles are    described   by an array   of   Reals and  a
56 //! Dimension. Example : Inserting knots.
57 //!
58 //! - Local methods  computing  points and derivatives.  The
59 //! poles  are described by a pointer  on  a local array  of
60 //! Reals and a Dimension. The local array is modified.
61 //!
62 //! *  2D  and 3D spline   curves  methods.
63 //!
64 //! Methods  for 2d and 3d BSplines  curves  rational or not
65 //! rational.
66 //!
67 //! Those methods have the following structure :
68 //!
69 //! - They extract the pole information in a working array.
70 //!
71 //! -  They      process the  working   array    with   the
72 //! multi-dimension  methods. (for example  a  3d  rational
73 //! curve is processed as a 4 dimension curve).
74 //!
75 //! - They get back the result in the original dimension.
76 //!
77 //! Note that the  bspline   surface methods found   in the
78 //! package BSplSLib  uses  the same  structure and rely on
79 //! BSplCLib.
80 //!
81 //! In the following list  of methods the  2d and 3d  curve
82 //! methods   will be  described   with  the  corresponding
83 //! multi-dimension method.
84 //!
85 //! The 3d or 2d B-spline curve is defined with :
86 //!
87 //! . its control points : TColgp_Array1OfPnt(2d)        Poles
88 //! . its weights        : TColStd_Array1OfReal          Weights
89 //! . its knots          : TColStd_Array1OfReal          Knots
90 //! . its multiplicities : TColStd_Array1OfInteger       Mults
91 //! . its degree         : Standard_Integer              Degree
92 //! . its periodicity    : Standard_Boolean              Periodic
93 //!
94 //! Warnings :
95 //! The bounds of Poles and Weights should be the same.
96 //! The bounds of Knots and Mults   should be the same.
97 //!
98 //! Note: weight and multiplicity arrays can be passed by pointer for
99 //! some functions so that NULL pointer is valid.
100 //! That means no weights/no multiplicities passed.
101 //!
102 //! No weights (BSplCLib::NoWeights()) means the curve is non rational.
103 //! No mults (BSplCLib::NoMults()) means the knots are "flat" knots.
104 //!
105 //! KeyWords :
106 //! B-spline curve, Functions, Library
107 //!
108 //! References :
109 //! . A survey of curves and surfaces methods in CADG Wolfgang
110 //! BOHM CAGD 1 (1984)
111 //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM
112 //! cagd 5 (1988)
113 //! . Blossoming and knot insertion algorithms for B-spline curves
114 //! Ronald N. GOLDMAN
115 //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA
116 //! . Curves and Surfaces for Computer Aided Geometric Design,
117 //! a practical guide Gerald Farin
118 class BSplCLib 
119 {
120 public:
121
122   DEFINE_STANDARD_ALLOC
123
124   
125   //! This routine searches the position of the real value theX
126   //! in the monotonically increasing set of real values theArray using bisection algorithm.
127   //!
128   //! If the given value is out of range or array values, algorithm returns either
129   //! theArray.Lower()-1 or theArray.Upper()+1 depending on theX position in the ordered set.
130   //!
131   //! This routine is used to locate a knot value in a set of knots.
132   Standard_EXPORT static void Hunt (const TColStd_Array1OfReal& theArray,
133                                     const Standard_Real theX,
134                                     Standard_Integer& theXPos);
135   
136   //! Computes the index of the knots value which gives
137   //! the start point of the curve.
138   Standard_EXPORT static Standard_Integer FirstUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
139   
140   //! Computes the index of the knots value which gives
141   //! the end point of the curve.
142   Standard_EXPORT static Standard_Integer LastUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
143   
144   //! Computes the index  of  the  flats knots  sequence
145   //! corresponding  to  <Index> in  the  knots sequence
146   //! which multiplicities are <Mults>.
147   Standard_EXPORT static Standard_Integer FlatIndex (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic);
148   
149   //! Locates  the parametric value    U  in the knots
150   //! sequence  between  the  knot K1   and the knot  K2.
151   //! The value return in Index verifies.
152   //!
153   //! Knots(Index) <= U < Knots(Index + 1)
154   //! if U <= Knots (K1) then Index = K1
155   //! if U >= Knots (K2) then Index = K2 - 1
156   //!
157   //! If Periodic is True U  may be  modified  to fit in
158   //! the range  Knots(K1), Knots(K2).  In any case  the
159   //! correct value is returned in NewU.
160   //!
161   //! Warnings :Index is used  as input   data to initialize  the
162   //! searching  function.
163   //! Warning: Knots have to be "withe repetitions"
164   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
165   
166   //! Locates  the parametric value    U  in the knots
167   //! sequence  between  the  knot K1   and the knot  K2.
168   //! The value return in Index verifies.
169   //!
170   //! Knots(Index) <= U < Knots(Index + 1)
171   //! if U <= Knots (K1) then Index = K1
172   //! if U >= Knots (K2) then Index = K2 - 1
173   //!
174   //! If Periodic is True U  may be  modified  to fit in
175   //! the range  Knots(K1), Knots(K2).  In any case  the
176   //! correct value is returned in NewU.
177   //!
178   //! Warnings :Index is used  as input   data to initialize  the
179   //! searching  function.
180   //! Warning: Knots have to be "flat"
181   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
182   
183   Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, const Standard_Real U, const Standard_Boolean Periodic, Standard_Integer& Index, Standard_Real& NewU);
184   
185   //! Finds the greatest multiplicity in a set of knots
186   //! between  K1  and K2.   Mults  is  the  multiplicity
187   //! associated with each knot value.
188   Standard_EXPORT static Standard_Integer MaxKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
189   
190   //! Finds the lowest multiplicity in  a  set of knots
191   //! between   K1  and K2.   Mults is  the  multiplicity
192   //! associated with each knot value.
193   Standard_EXPORT static Standard_Integer MinKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
194   
195   //! Returns the number of poles of the curve. Returns 0 if
196   //! one of the multiplicities is incorrect.
197   //!
198   //! * Non positive.
199   //!
200   //! * Greater than Degree,  or  Degree+1  at the first and
201   //! last knot of a non periodic curve.
202   //!
203   //! *  The  last periodicity  on  a periodic  curve is not
204   //! equal to the first.
205   Standard_EXPORT static Standard_Integer NbPoles (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
206   
207   //! Returns the length  of the sequence  of knots with
208   //! repetition.
209   //!
210   //! Periodic :
211   //!
212   //! Sum(Mults(i), i = Mults.Lower(); i <= Mults.Upper());
213   //!
214   //! Non Periodic :
215   //!
216   //! Sum(Mults(i); i = Mults.Lower(); i < Mults.Upper())
217   //! + 2 * Degree
218   Standard_EXPORT static Standard_Integer KnotSequenceLength (const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic);
219   
220   Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
221   
222   //! Computes  the  sequence   of knots KnotSeq  with
223   //! repetition  of the  knots  of multiplicity  greater
224   //! than 1.
225   //!
226   //! Length of KnotSeq must be KnotSequenceLength(Mults,Degree,Periodic)
227   Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic, TColStd_Array1OfReal& KnotSeq);
228   
229   //! Returns the  length  of the   sequence of  knots  (and
230   //! Mults)  without repetition.
231   Standard_EXPORT static Standard_Integer KnotsLength (const TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
232   
233   //! Computes  the  sequence   of knots Knots  without
234   //! repetition  of the  knots  of multiplicity  greater
235   //! than 1.
236   //!
237   //! Length  of <Knots> and  <Mults> must be
238   //! KnotsLength(KnotSequence,Periodic)
239   Standard_EXPORT static void Knots (const TColStd_Array1OfReal& KnotSeq, TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic = Standard_False);
240   
241   //! Analyses if the  knots distribution is "Uniform"
242   //! or  "NonUniform" between  the  knot  FromK1 and the
243   //! knot ToK2.  There is  no repetition of  knot in the
244   //! knots'sequence <Knots>.
245   Standard_EXPORT static BSplCLib_KnotDistribution KnotForm (const TColStd_Array1OfReal& Knots, const Standard_Integer FromK1, const Standard_Integer ToK2);
246   
247
248   //! Analyses the distribution of multiplicities between
249   //! the knot FromK1 and the Knot ToK2.
250   Standard_EXPORT static BSplCLib_MultDistribution MultForm (const TColStd_Array1OfInteger& Mults, const Standard_Integer FromK1, const Standard_Integer ToK2);
251   
252   //! Analyzes the array of knots.
253   //! Returns the form and the maximum knot multiplicity.
254   Standard_EXPORT static void KnotAnalysis (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& CKnots, const TColStd_Array1OfInteger& CMults, GeomAbs_BSplKnotDistribution& KnotForm, Standard_Integer& MaxKnotMult);
255   
256
257   //! Reparametrizes a B-spline curve to [U1, U2].
258   //! The knot values are recomputed such that Knots (Lower) = U1
259   //! and Knots (Upper) = U2   but the knot form is not modified.
260   //! Warnings :
261   //! In the array Knots the values must be in ascending order.
262   //! U1 must not be equal to U2 to avoid division by zero.
263   Standard_EXPORT static void Reparametrize (const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& Knots);
264   
265   //! Reverses  the  array   knots  to  become  the knots
266   //! sequence of the reversed curve.
267   Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Knots);
268   
269   //! Reverses  the  array of multiplicities.
270   Standard_EXPORT static void Reverse (TColStd_Array1OfInteger& Mults);
271   
272   //! Reverses the array of poles. Last is the  index of
273   //! the new first pole. On  a  non periodic curve last
274   //! is Poles.Upper(). On a periodic curve last is
275   //!
276   //! (number of flat knots - degree - 1)
277   //!
278   //! or
279   //!
280   //! (sum of multiplicities(but  for the last) + degree
281   //! - 1)
282   Standard_EXPORT static void Reverse (TColgp_Array1OfPnt& Poles, const Standard_Integer Last);
283   
284   //! Reverses the array of poles.
285   Standard_EXPORT static void Reverse (TColgp_Array1OfPnt2d& Poles, const Standard_Integer Last);
286   
287   //! Reverses the array of poles.
288   Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Weights, const Standard_Integer Last);
289   
290
291   //! Returns False if all the weights  of the  array <Weights>
292   //! between   I1 an I2   are  identic.   Epsilon  is used for
293   //! comparing  weights. If Epsilon  is 0. the  Epsilon of the
294   //! first weight is used.
295   Standard_EXPORT static Standard_Boolean IsRational (const TColStd_Array1OfReal& Weights, const Standard_Integer I1, const Standard_Integer I2, const Standard_Real Epsilon = 0.0);
296   
297   //! returns the degree maxima for a BSplineCurve.
298     static Standard_Integer MaxDegree();
299   
300   //! Perform the Boor  algorithm  to  evaluate a point at
301   //! parameter <U>, with <Degree> and <Dimension>.
302   //!
303   //! Poles is  an array of  Reals of size
304   //!
305   //! <Dimension> *  <Degree>+1
306   //!
307   //! Containing  the poles.  At  the end <Poles> contains
308   //! the current point.
309   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
310   
311   //! Performs the  Boor Algorithm  at  parameter <U> with
312   //! the given <Degree> and the  array of <Knots> on  the
313   //! poles <Poles> of dimension  <Dimension>.  The schema
314   //! is  computed  until  level  <Depth>  on a   basis of
315   //! <Length+1> poles.
316   //!
317   //! * Knots is an array of reals of length :
318   //!
319   //! <Length> + <Degree>
320   //!
321   //! * Poles is an array of reals of length :
322   //!
323   //! (2 * <Length> + 1) * <Dimension>
324   //!
325   //! The poles values  must be  set  in the array at the
326   //! positions.
327   //!
328   //! 0..Dimension,
329   //!
330   //! 2 * Dimension ..
331   //! 3 * Dimension
332   //!
333   //! 4  * Dimension ..
334   //! 5  * Dimension
335   //!
336   //! ...
337   //!
338   //! The results are found in the array poles depending
339   //! on the Depth. (See the method GetPole).
340   Standard_EXPORT static void BoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length);
341   
342   //! Compute  the content of  Pole before the BoorScheme.
343   //! This method is used to remove poles.
344   //!
345   //! U is the poles to  remove, Knots should contains the
346   //! knots of the curve after knot removal.
347   //!
348   //! The first  and last poles  do not  change, the other
349   //! poles are computed by averaging two possible values.
350   //! The distance between  the  two   possible  poles  is
351   //! computed, if it  is higher than <Tolerance> False is
352   //! returned.
353   Standard_EXPORT static Standard_Boolean AntiBoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length, const Standard_Real Tolerance);
354   
355   //! Computes   the   poles of  the    BSpline  giving the
356   //! derivatives of order <Order>.
357   //!
358   //! The formula for the first order is
359   //!
360   //! Pole(i) = Degree * (Pole(i+1) - Pole(i)) /
361   //! (Knots(i+Degree+1) - Knots(i+1))
362   //!
363   //! This formula  is repeated  (Degree  is decremented at
364   //! each step).
365   Standard_EXPORT static void Derivative (const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, const Standard_Integer Length, const Standard_Integer Order, Standard_Real& Poles);
366   
367   //! Performs the Bohm  Algorithm at  parameter <U>. This
368   //! algorithm computes the value and all the derivatives
369   //! up to order N (N <= Degree).
370   //!
371   //! <Poles> is the original array of poles.
372   //!
373   //! The   result in  <Poles>  is    the value and    the
374   //! derivatives.  Poles[0] is  the value,  Poles[Degree]
375   //! is the last  derivative.
376   Standard_EXPORT static void Bohm (const Standard_Real U, const Standard_Integer Degree, const Standard_Integer N, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
377   
378   //! Used as argument for a non rational curve.
379     static TColStd_Array1OfReal* NoWeights();
380   
381   //! Used as argument for a flatknots evaluation.
382     static TColStd_Array1OfInteger* NoMults();
383   
384   //! Stores in LK the useful knots for the BoorSchem
385   //! on the span Knots(Index) - Knots(Index+1)
386   Standard_EXPORT static void BuildKnots (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& LK);
387   
388   //! Return the index of the  first Pole to  use on the
389   //! span  Mults(Index)  - Mults(Index+1).  This  index
390   //! must be added to Poles.Lower().
391   Standard_EXPORT static Standard_Integer PoleIndex (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
392   
393   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
394   
395   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
396   
397   //! Copy in <LP>  the poles and  weights for  the Eval
398   //! scheme. starting from  Poles(Poles.Lower()+Index)
399   Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
400   
401   //! Copy in <LP>  poles for <Dimension>  Boor  scheme.
402   //! Starting  from    <Index>     *  <Dimension>, copy
403   //! <Length+1> poles.
404   Standard_EXPORT static void BuildBoor (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, Standard_Real& LP);
405   
406   //! Returns the index in  the Boor result array of the
407   //! poles <Index>. If  the Boor  algorithm was perform
408   //! with <Length> and <Depth>.
409   Standard_EXPORT static Standard_Integer BoorIndex (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth);
410   
411   //! Copy  the  pole at  position  <Index>  in  the Boor
412   //! scheme of   dimension <Dimension> to  <Position> in
413   //! the array <Pole>. <Position> is updated.
414   Standard_EXPORT static void GetPole (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth, const Standard_Integer Dimension, Standard_Real& LocPoles, Standard_Integer& Position, TColStd_Array1OfReal& Pole);
415   
416   //! Returns in <NbPoles, NbKnots> the  new number of poles
417   //! and  knots    if  the  sequence   of  knots <AddKnots,
418   //! AddMults> is inserted in the sequence <Knots, Mults>.
419   //!
420   //! Epsilon is used to compare knots for equality.
421   //!
422   //! If Add is True  the multiplicities on  equal knots are
423   //! added.
424   //!
425   //! If Add is False the max value of the multiplicities is
426   //! kept.
427   //!
428   //! Return False if :
429   //! The knew knots are knot increasing.
430   //! The new knots are not in the range.
431   Standard_EXPORT static Standard_Boolean PrepareInsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, Standard_Integer& NbPoles, Standard_Integer& NbKnots, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
432   
433   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
434   
435   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
436   
437   //! Insert   a  sequence  of  knots <AddKnots> with
438   //! multiplicities   <AddMults>. <AddKnots>   must  be a   non
439   //! decreasing sequence and verifies :
440   //!
441   //! Knots(Knots.Lower()) <= AddKnots(AddKnots.Lower())
442   //! Knots(Knots.Upper()) >= AddKnots(AddKnots.Upper())
443   //!
444   //! The NewPoles and NewWeights arrays must have a length :
445   //! Poles.Length() + Sum(AddMults())
446   //!
447   //! When a knot  to insert is identic  to an existing knot the
448   //! multiplicities   are added.
449   //!
450   //! Epsilon is used to test knots for equality.
451   //!
452   //! When AddMult is negative or null the knot is not inserted.
453   //! No multiplicity will becomes higher than the degree.
454   //!
455   //! The new Knots and Multiplicities  are copied in <NewKnots>
456   //! and  <NewMults>.
457   //!
458   //! All the New arrays should be correctly dimensioned.
459   //!
460   //! When all  the new knots  are existing knots, i.e. only the
461   //! multiplicities  will  change it is   safe to  use the same
462   //! arrays as input and output.
463   Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
464   
465   Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
466   
467   //! Insert a new knot U of multiplicity UMult in the
468   //! knot sequence.
469   //!
470   //! The  location of the new Knot  should be given as an input
471   //! data.  UIndex locates the new knot U  in the knot sequence
472   //! and Knots (UIndex) < U < Knots (UIndex + 1).
473   //!
474   //! The new control points corresponding to this insertion are
475   //! returned. Knots and Mults are not updated.
476   Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
477   
478   Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
479   
480   //! Raise the multiplicity of knot to <UMult>.
481   //!
482   //! The new control points  are  returned. Knots and Mults are
483   //! not updated.
484   Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
485   
486   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
487   
488   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
489   
490   //! Decrement the  multiplicity  of <Knots(Index)>
491   //! to <Mult>. If <Mult>   is  null the   knot  is
492   //! removed.
493   //!
494   //! As there are two ways to compute the new poles
495   //! the midlle   will  be used  as  long    as the
496   //! distance is lower than Tolerance.
497   //!
498   //! If a  distance is  bigger  than  tolerance the
499   //! methods returns False  and  the new arrays are
500   //! not modified.
501   //!
502   //! A low  tolerance can be  used  to test  if the
503   //! knot  can be  removed  without  modifying  the
504   //! curve.
505   //!
506   //! A high tolerance  can be used  to "smooth" the
507   //! curve.
508   Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
509   
510   //! Returns the   number   of  knots   of  a  curve   with
511   //! multiplicities <Mults> after elevating the degree from
512   //! <Degree> to <NewDegree>. See the IncreaseDegree method
513   //! for more comments.
514   Standard_EXPORT static Standard_Integer IncreaseDegreeCountKnots (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
515   
516   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
517   
518   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
519   
520   Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
521   
522   Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
523   
524   //! Increase the degree of a bspline (or bezier) curve
525   //! of dimension theDimension form theDegree to theNewDegree.
526   //!
527   //! The number of poles in the new curve is:
528   //! @code
529   //!   Poles.Length() + (NewDegree - Degree) * Number of spans
530   //! @endcode
531   //! Where the number of spans is:
532   //! @code
533   //!   LastUKnotIndex(Mults) - FirstUKnotIndex(Mults) + 1
534   //! @endcode
535   //! for a non-periodic curve, and
536   //! @code
537   //!   Knots.Length() - 1
538   //! @endcode
539   //! for a periodic curve.
540   //!
541   //! The multiplicities of all knots are increased by the degree elevation.
542   //!
543   //! The new knots are usually the same knots with the
544   //! exception of a non-periodic curve with the first
545   //! and last multiplicity not  equal to Degree+1 where
546   //! knots are removed form the start and the bottom
547   //! until the sum of the multiplicities is equal to
548   //! NewDegree+1  at the knots corresponding to the
549   //! first and last parameters of the curve.
550   //!
551   //! Example: Suppose a curve of degree 3 starting
552   //! with following knots and multiplicities:
553   //! @code
554   //!   knot : 0.  1.  2.
555   //!   mult : 1   2   1
556   //! @endcode
557   //!
558   //! The FirstUKnot is 2.0 because the sum of multiplicities is
559   //! @code
560   //!   Degree+1 : 1 + 2 + 1 = 4 = 3 + 1
561   //! @endcode
562   //! i.e. the first parameter of the curve is 2.0 and
563   //! will still be 2.0 after degree elevation.
564   //! Let raise this curve to degree 4.
565   //! The multiplicities are increased by 2.
566   //!
567   //! They  become 2 3 2.
568   //! But we need a sum of multiplicities of 5 at knot 2.
569   //! So the first knot is removed and the new knots are:
570   //! @code
571   //!   knot : 1.  2.
572   //!   mult : 3   2
573   //! @endcode
574   //! The multipicity of the first knot may also be reduced if the sum is still to big.
575   //!
576   //! In the most common situations (periodic curve or curve with first
577   //! and last multiplicities equals to Degree+1) the knots are knot changes.
578   //!
579   //! The method IncreaseDegreeCountKnots can be used to compute the new number of knots.
580   Standard_EXPORT static void IncreaseDegree (const Standard_Integer theNewDegree,
581                                               const TColgp_Array1OfPnt2d& thePoles,
582                                               const TColStd_Array1OfReal* theWeights,
583                                               TColgp_Array1OfPnt2d& theNewPoles,
584                                               TColStd_Array1OfReal* theNewWeights);
585
586   //! Set in <NbKnots> and <NbPolesToAdd> the number of Knots and
587   //! Poles   of  the NotPeriodic  Curve   identical  at the
588   //! periodic     curve with    a  degree    <Degree>  ,  a
589   //! knots-distribution with Multiplicities <Mults>.
590   Standard_EXPORT static void PrepareUnperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
591   
592   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const Standard_Integer Dimension, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfReal& Poles, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfReal& NewPoles);
593   
594   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
595   
596   Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
597   
598   //! Set in <NbKnots> and <NbPoles> the number of Knots and
599   //! Poles of the curve resulting from  the trimming of the
600   //! BSplinecurve defined with <degree>, <knots>, <mults>
601   Standard_EXPORT static void PrepareTrimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U1, const Standard_Real U2, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
602   
603   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Poles, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewPoles);
604   
605   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
606   
607   Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
608   
609   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P);
610   
611   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P);
612   
613   Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P);
614   
615   Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P);
616   
617   Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P);
618   
619   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V);
620   
621   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V);
622   
623   Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V);
624   
625   Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V);
626   
627   Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V);
628   
629   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2);
630   
631   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
632   
633   Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
634   
635   Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
636   
637   Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
638   
639   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3);
640   
641   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
642   
643   Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
644   
645   Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
646   
647   Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
648   
649   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& VN);
650   
651   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec& VN);
652   
653   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec2d& V);
654   
655   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt& P, gp_Vec& VN);
656   
657   //! The  above  functions  compute   values and
658   //! derivatives in the following situations :
659   //!
660   //! * 3D, 2D and 1D
661   //!
662   //! * Rational or not Rational.
663   //!
664   //! * Knots  and multiplicities or "flat knots" without
665   //! multiplicities.
666   //!
667   //! * The  <Index>  is   the localization  of  the
668   //! parameter in the knot sequence.  If <Index> is  out
669   //! of range the correct value will be searched.
670   //!
671   //! VERY IMPORTANT!!!
672   //! USE  BSplCLib::NoWeights()  as Weights argument for non
673   //! rational curves computations.
674   Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt2d& P, gp_Vec2d& VN);
675   
676   //! This  evaluates  the Bspline  Basis  at  a
677   //! given  parameter  Parameter   up   to  the
678   //! requested   DerivativeOrder  and store the
679   //! result  in the  array BsplineBasis  in the
680   //! following   fashion
681   //! BSplineBasis(1,1)   =
682   //! value of first non vanishing
683   //! Bspline function which has Index FirstNonZeroBsplineIndex
684   //! BsplineBasis(1,2)   =
685   //! value of second non vanishing
686   //! Bspline   function which  has   Index
687   //! FirstNonZeroBsplineIndex + 1
688   //! BsplineBasis(1,n)   =
689   //! value of second non vanishing non vanishing
690   //! Bspline   function which  has   Index
691   //! FirstNonZeroBsplineIndex + n (n <= Order)
692   //! BSplineBasis(2,1)   =
693   //! value of derivative of first non vanishing
694   //! Bspline function which has Index FirstNonZeroBsplineIndex
695   //! BSplineBasis(N,1)   =
696   //! value of Nth derivative of first non vanishing
697   //! Bspline function which has Index FirstNonZeroBsplineIndex
698   //! if N <= DerivativeOrder + 1
699   Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer DerivativeOrder,
700                                                             const Standard_Integer Order,
701                                                             const TColStd_Array1OfReal& FlatKnots,
702                                                             const Standard_Real Parameter,
703                                                             Standard_Integer& FirstNonZeroBsplineIndex,
704                                                             math_Matrix& BsplineBasis,
705                                                             const Standard_Boolean isPeriodic = Standard_False);
706   
707   //! This Builds   a fully  blown   Matrix of
708   //! (ni)
709   //! Bi    (tj)
710   //!
711   //! with i  and j within 1..Order + NumPoles
712   //! The  integer ni is   the ith slot of the
713   //! array OrderArray, tj is the jth slot of
714   //! the array Parameters
715   Standard_EXPORT static Standard_Integer BuildBSpMatrix (const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& OrderArray, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, math_Matrix& Matrix, Standard_Integer& UpperBandWidth, Standard_Integer& LowerBandWidth);
716   
717   //! this  factors  the Banded Matrix in
718   //! the LU form with a Banded storage of
719   //! components of the L matrix
720   //! WARNING : do not use if the Matrix is
721   //! totally positive (It is the case for
722   //! Bspline matrices build as above with
723   //! parameters being the Schoenberg points
724   Standard_EXPORT static Standard_Integer FactorBandedMatrix (math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, Standard_Integer& PivotIndexProblem);
725   
726   //! This solves  the system Matrix.X =  B
727   //! with when Matrix is factored in LU form
728   //! The  Array   is    an   seen   as    an
729   //! Array[1..N][1..ArrayDimension] with N =
730   //! the  rank  of the  matrix  Matrix.  The
731   //! result is stored   in Array  when  each
732   //! coordinate is  solved that is  B is the
733   //! array whose values are
734   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
735   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Integer ArrayDimension, Standard_Real& Array);
736   
737   //! This solves  the system Matrix.X =  B
738   //! with when Matrix is factored in LU form
739   //! The  Array   has the length of
740   //! the  rank  of the  matrix  Matrix.  The
741   //! result is stored   in Array  when  each
742   //! coordinate is  solved that is  B is the
743   //! array whose values are
744   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
745   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt2d& Array);
746   
747   //! This solves  the system Matrix.X =  B
748   //! with when Matrix is factored in LU form
749   //! The  Array   has the length of
750   //! the  rank  of the  matrix  Matrix.  The
751   //! result is stored   in Array  when  each
752   //! coordinate is  solved that is  B is the
753   //! array whose values are
754   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
755   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt& Array);
756   
757   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogenousFlag, const Standard_Integer ArrayDimension, Standard_Real& Array, Standard_Real& Weights);
758   
759   //! This solves the  system Matrix.X =  B
760   //! with when Matrix is factored in LU form
761   //! The    Array   is    an   seen  as   an
762   //! Array[1..N][1..ArrayDimension] with N =
763   //! the  rank  of  the  matrix Matrix.  The
764   //! result is  stored   in Array when  each
765   //! coordinate is  solved that is B  is the
766   //! array  whose   values     are   B[i]  =
767   //! Array[i][p]       for     each  p    in
768   //! 1..ArrayDimension. If  HomogeneousFlag ==
769   //! 0  the  Poles  are  multiplied by   the
770   //! Weights   upon   Entry   and      once
771   //! interpolation   is    carried  over the
772   //! result of the  poles are divided by the
773   //! result of   the   interpolation of  the
774   //! weights. Otherwise if HomogenousFlag == 1
775   //! the Poles and Weigths are treated homogeneously
776   //! that is that those are interpolated as they
777   //! are and result is returned without division
778   //! by the interpolated weigths.
779   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogenousFlag, TColgp_Array1OfPnt2d& Array, TColStd_Array1OfReal& Weights);
780   
781   //! This solves  the system Matrix.X =  B
782   //! with when Matrix is factored in LU form
783   //! The  Array   is    an   seen   as    an
784   //! Array[1..N][1..ArrayDimension] with N =
785   //! the  rank  of the  matrix  Matrix.  The
786   //! result is stored   in Array  when  each
787   //! coordinate is  solved that is  B is the
788   //! array whose values are
789   //! B[i] = Array[i][p] for each p in 1..ArrayDimension
790   //! If  HomogeneousFlag ==
791   //! 0  the  Poles  are  multiplied by   the
792   //! Weights   upon   Entry   and      once
793   //! interpolation   is    carried  over the
794   //! result of the  poles are divided by the
795   //! result of   the   interpolation of  the
796   //! weights. Otherwise if HomogenousFlag == 1
797   //! the Poles and Weigths are treated homogeneously
798   //! that is that those are interpolated as they
799   //! are and result is returned without division
800   //! by the interpolated weigths.
801   Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, const Standard_Boolean HomogeneousFlag, TColgp_Array1OfPnt& Array, TColStd_Array1OfReal& Weights);
802   
803   //! Merges  two knot vector by   setting the starting and
804   //! ending values to StartValue and EndValue
805   Standard_EXPORT static void MergeBSplineKnots (const Standard_Real Tolerance, const Standard_Real StartValue, const Standard_Real EndValue, const Standard_Integer Degree1, const TColStd_Array1OfReal& Knots1, const TColStd_Array1OfInteger& Mults1, const Standard_Integer Degree2, const TColStd_Array1OfReal& Knots2, const TColStd_Array1OfInteger& Mults2, Standard_Integer& NumPoles, Handle(TColStd_HArray1OfReal)& NewKnots, Handle(TColStd_HArray1OfInteger)& NewMults);
806   
807   //! This function will compose  a given Vectorial BSpline F(t)
808   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
809   //! its Poles  array which are coded as  an array of Real
810   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
811   //! function     a(t) which is   assumed to   satisfy the
812   //! following:
813   //!
814   //! 1. F(a(t))  is a polynomial BSpline
815   //! that can be expressed  exactly as a BSpline of degree
816   //! NewDegree on the knots FlatKnots
817   //!
818   //! 2. a(t) defines a differentiable
819   //! isomorphism between the range of FlatKnots to the range
820   //! of BSplineFlatKnots which is the
821   //! same as the  range of F(t)
822   //!
823   //! Warning: it is
824   //! the caller's responsibility to insure that conditions
825   //! 1. and  2. above are  satisfied : no check whatsoever
826   //! is made in this method
827   //!
828   //! theStatus will return 0 if OK else it will return the pivot index
829   //! of the matrix that was inverted to compute the multiplied
830   //! BSpline : the method used is interpolation at Schoenenberg
831   //! points of F(a(t))
832   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
833   
834   //! This function will compose  a given Vectorial BSpline F(t)
835   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
836   //! its Poles  array which are coded as  an array of Real
837   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
838   //! function     a(t) which is   assumed to   satisfy the
839   //! following:
840   //!
841   //! 1. F(a(t))  is a polynomial BSpline
842   //! that can be expressed  exactly as a BSpline of degree
843   //! NewDegree on the knots FlatKnots
844   //!
845   //! 2. a(t) defines a differentiable
846   //! isomorphism between the range of FlatKnots to the range
847   //! of BSplineFlatKnots which is the
848   //! same as the  range of F(t)
849   //!
850   //! Warning: it is
851   //! the caller's responsibility to insure that conditions
852   //! 1. and  2. above are  satisfied : no check whatsoever
853   //! is made in this method
854   //!
855   //! theStatus will return 0 if OK else it will return the pivot index
856   //! of the matrix that was inverted to compute the multiplied
857   //! BSpline : the method used is interpolation at Schoenenberg
858   //! points of F(a(t))
859   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
860   
861   //! this will compose  a given Vectorial BSpline F(t)
862   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
863   //! its Poles  array which are coded as  an array of Real
864   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
865   //! function     a(t) which is   assumed to   satisfy the
866   //! following  : 1. F(a(t))  is a polynomial BSpline
867   //! that can be expressed  exactly as a BSpline of degree
868   //! NewDegree on the knots FlatKnots
869   //! 2. a(t) defines a differentiable
870   //! isomorphism between the range of FlatKnots to the range
871   //! of BSplineFlatKnots which is the
872   //! same as the  range of F(t)
873   //! Warning: it is
874   //! the caller's responsibility to insure that conditions
875   //! 1. and  2. above are  satisfied : no check whatsoever
876   //! is made in this method
877   //! theStatus will return 0 if OK else it will return the pivot index
878   //! of the matrix that was inverted to compute the multiplied
879   //! BSpline : the method used is interpolation at Schoenenberg
880   //! points of F(a(t))
881   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
882   
883   //! this will compose  a given Vectorial BSpline F(t)
884   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
885   //! its Poles  array which are coded as  an array of Real
886   //! of  the  form  [1..NumPoles][1..PolesDimension] with  a
887   //! function     a(t) which is   assumed to   satisfy the
888   //! following  : 1. F(a(t))  is a polynomial BSpline
889   //! that can be expressed  exactly as a BSpline of degree
890   //! NewDegree on the knots FlatKnots
891   //! 2. a(t) defines a differentiable
892   //! isomorphism between the range of FlatKnots to the range
893   //! of BSplineFlatKnots which is the
894   //! same as the  range of F(t)
895   //! Warning: it is
896   //! the caller's responsibility to insure that conditions
897   //! 1. and  2. above are  satisfied : no check whatsoever
898   //! is made in this method
899   //! theStatus will return 0 if OK else it will return the pivot index
900   //! of the matrix that was inverted to compute the multiplied
901   //! BSpline : the method used is interpolation at Schoenenberg
902   //! points of F(a(t))
903   Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
904   
905   //! this will  multiply a given Vectorial BSpline F(t)
906   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
907   //! its Poles  array which are coded as  an array of Real
908   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
909   //! function     a(t) which is   assumed to   satisfy the
910   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
911   //! that can be expressed  exactly as a BSpline of degree
912   //! NewDegree on the knots FlatKnots 2. the range of a(t)
913   //! is the same as the  range of F(t)
914   //! Warning: it is
915   //! the caller's responsibility to insure that conditions
916   //! 1. and  2. above are  satisfied : no check whatsoever
917   //! is made in this method
918   //! theStatus will return 0 if OK else it will return the pivot index
919   //! of the matrix that was inverted to compute the multiplied
920   //! BSpline : the method used is interpolation at Schoenenberg
921   //! points of a(t)*F(t)
922   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
923   
924   //! this will  multiply a given Vectorial BSpline F(t)
925   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
926   //! its Poles  array which are coded as  an array of Real
927   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
928   //! function     a(t) which is   assumed to   satisfy the
929   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
930   //! that can be expressed  exactly as a BSpline of degree
931   //! NewDegree on the knots FlatKnots 2. the range of a(t)
932   //! is the same as the  range of F(t)
933   //! Warning: it is
934   //! the caller's responsibility to insure that conditions
935   //! 1. and  2. above are  satisfied : no check whatsoever
936   //! is made in this method
937   //! theStatus will return 0 if OK else it will return the pivot index
938   //! of the matrix that was inverted to compute the multiplied
939   //! BSpline : the method used is interpolation at Schoenenberg
940   //! points of a(t)*F(t)
941   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
942   
943   //! this will  multiply a given Vectorial BSpline F(t)
944   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
945   //! its Poles  array which are coded as  an array of Real
946   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
947   //! function     a(t) which is   assumed to   satisfy the
948   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
949   //! that can be expressed  exactly as a BSpline of degree
950   //! NewDegree on the knots FlatKnots 2. the range of a(t)
951   //! is the same as the  range of F(t)
952   //! Warning: it is
953   //! the caller's responsibility to insure that conditions
954   //! 1. and  2. above are  satisfied : no check whatsoever
955   //! is made in this method
956   //! theStatus will return 0 if OK else it will return the pivot index
957   //! of the matrix that was inverted to compute the multiplied
958   //! BSpline : the method used is interpolation at Schoenenberg
959   //! points of a(t)*F(t)
960   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
961   
962   //! this will  multiply a given Vectorial BSpline F(t)
963   //! defined  by its  BSplineDegree and BSplineFlatKnotsl,
964   //! its Poles  array which are coded as  an array of Real
965   //! of  the  form  [1..NumPoles][1..PolesDimension] by  a
966   //! function     a(t) which is   assumed to   satisfy the
967   //! following  : 1. a(t)  * F(t)  is a polynomial BSpline
968   //! that can be expressed  exactly as a BSpline of degree
969   //! NewDegree on the knots FlatKnots 2. the range of a(t)
970   //! is the same as the  range of F(t)
971   //! Warning: it is
972   //! the caller's responsibility to insure that conditions
973   //! 1. and  2. above are  satisfied : no check whatsoever
974   //! is made in this method
975   //! theStatus will return 0 if OK else it will return the pivot index
976   //! of the matrix that was inverted to compute the multiplied
977   //! BSpline : the method used is interpolation at Schoenenberg
978   //! points of a(t)*F(t)
979   Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
980   
981   //! Perform the De Boor   algorithm  to  evaluate a point at
982   //! parameter <U>, with <Degree> and <Dimension>.
983   //!
984   //! Poles is  an array of  Reals of size
985   //!
986   //! <Dimension> *  <Degree>+1
987   //!
988   //! Containing the  poles.  At  the end <Poles> contains
989   //! the current point.   Poles Contain all  the poles of
990   //! the BsplineCurve, Knots  also Contains all the knots
991   //! of the BsplineCurve.  ExtrapMode has two slots [0] =
992   //! Degree used to extrapolate before the first knot [1]
993   //! = Degre used to  extrapolate after the last knot has
994   //! to be between 1 and  Degree
995   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Integer DerivativeRequest, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Result);
996   
997   //! Perform the  De Boor algorithm  to evaluate a point at
998   //! parameter   <U>,  with   <Degree>    and  <Dimension>.
999   //! Evaluates by multiplying the  Poles by the Weights and
1000   //! gives  the homogeneous  result  in PolesResult that is
1001   //! the results of the evaluation of the numerator once it
1002   //! has     been  multiplied   by  the     weights and  in
1003   //! WeightsResult one has  the result of the evaluation of
1004   //! the denominator
1005   //!
1006   //! Warning:   <PolesResult> and <WeightsResult>  must be   dimensionned
1007   //! properly.
1008   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Integer DerivativeRequest, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Weights, Standard_Real& PolesResult, Standard_Real& WeightsResult);
1009   
1010   //! Perform the evaluation of the Bspline Basis
1011   //! and then multiplies by the weights
1012   //! this just evaluates the current point
1013   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Boolean HomogeneousFlag, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt& Point, Standard_Real& Weight);
1014   
1015   //! Perform the evaluation of the Bspline Basis
1016   //! and then multiplies by the weights
1017   //! this just evaluates the current point
1018   Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Boolean PeriodicFlag, const Standard_Boolean HomogeneousFlag, Standard_Integer& ExtrapMode, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt2d& Point, Standard_Real& Weight);
1019   
1020   //! Extend a BSpline nD using the tangency map
1021   //! <C1Coefficient> is the coefficient of reparametrisation
1022   //! <Continuity> must be equal to 1, 2 or 3.
1023   //! <Degree> must be greater or equal than <Continuity> + 1.
1024   //!
1025   //! Warning:   <KnotsResult> and <PolesResult>  must be   dimensionned
1026   //! properly.
1027   Standard_EXPORT static void TangExtendToConstraint (const TColStd_Array1OfReal& FlatKnots, const Standard_Real C1Coefficient, const Standard_Integer NumPoles, Standard_Real& Poles, const Standard_Integer Dimension, const Standard_Integer Degree, const TColStd_Array1OfReal& ConstraintPoint, const Standard_Integer Continuity, const Standard_Boolean After, Standard_Integer& NbPolesResult, Standard_Integer& NbKnotsRsult, Standard_Real& KnotsResult, Standard_Real& PolesResult);
1028   
1029   //! Perform the evaluation of the of the cache
1030   //! the parameter must be normalized between
1031   //! the 0 and 1 for the span.
1032   //! The Cache must be valid when calling this
1033   //! routine. Geom Package will insure that.
1034   //! and then multiplies by the weights
1035   //! this just evaluates the current point
1036   //! the CacheParameter is where the Cache was
1037   //! constructed the SpanLength is to normalize
1038   //! the polynomial in the cache to avoid bad conditioning
1039   //! effects
1040   Standard_EXPORT static void CacheD0 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
1041   
1042   //! Perform the evaluation of the Bspline Basis
1043   //! and then multiplies by the weights
1044   //! this just evaluates the current point
1045   //! the parameter must be normalized between
1046   //! the 0 and 1 for the span.
1047   //! The Cache must be valid when calling this
1048   //! routine. Geom Package will insure that.
1049   //! and then multiplies by the weights
1050   //! ththe CacheParameter is where the Cache was
1051   //! constructed the SpanLength is to normalize
1052   //! the polynomial in the cache to avoid bad conditioning
1053   //! effectsis just evaluates the current point
1054   Standard_EXPORT static void CacheD0 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
1055   
1056   //! Calls CacheD0 for Bezier  Curves Arrays computed with
1057   //! the method PolesCoefficients.
1058   //! Warning: To be used for Beziercurves ONLY!!!
1059     static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
1060   
1061   //! Calls CacheD0 for Bezier  Curves Arrays computed with
1062   //! the method PolesCoefficients.
1063   //! Warning: To be used for Beziercurves ONLY!!!
1064     static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
1065   
1066   //! Perform the evaluation of the of the cache
1067   //! the parameter must be normalized between
1068   //! the 0 and 1 for the span.
1069   //! The Cache must be valid when calling this
1070   //! routine. Geom Package will insure that.
1071   //! and then multiplies by the weights
1072   //! this just evaluates the current point
1073   //! the CacheParameter is where the Cache was
1074   //! constructed the SpanLength is to normalize
1075   //! the polynomial in the cache to avoid bad conditioning
1076   //! effects
1077   Standard_EXPORT static void CacheD1 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
1078   
1079   //! Perform the evaluation of the Bspline Basis
1080   //! and then multiplies by the weights
1081   //! this just evaluates the current point
1082   //! the parameter must be normalized between
1083   //! the 0 and 1 for the span.
1084   //! The Cache must be valid when calling this
1085   //! routine. Geom Package will insure that.
1086   //! and then multiplies by the weights
1087   //! ththe CacheParameter is where the Cache was
1088   //! constructed the SpanLength is to normalize
1089   //! the polynomial in the cache to avoid bad conditioning
1090   //! effectsis just evaluates the current point
1091   Standard_EXPORT static void CacheD1 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
1092   
1093   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1094   //! the method PolesCoefficients.
1095   //! Warning: To be used for Beziercurves ONLY!!!
1096     static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
1097   
1098   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1099   //! the method PolesCoefficients.
1100   //! Warning: To be used for Beziercurves ONLY!!!
1101     static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
1102   
1103   //! Perform the evaluation of the of the cache
1104   //! the parameter must be normalized between
1105   //! the 0 and 1 for the span.
1106   //! The Cache must be valid when calling this
1107   //! routine. Geom Package will insure that.
1108   //! and then multiplies by the weights
1109   //! this just evaluates the current point
1110   //! the CacheParameter is where the Cache was
1111   //! constructed the SpanLength is to normalize
1112   //! the polynomial in the cache to avoid bad conditioning
1113   //! effects
1114   Standard_EXPORT static void CacheD2 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2);
1115   
1116   //! Perform the evaluation of the Bspline Basis
1117   //! and then multiplies by the weights
1118   //! this just evaluates the current point
1119   //! the parameter must be normalized between
1120   //! the 0 and 1 for the span.
1121   //! The Cache must be valid when calling this
1122   //! routine. Geom Package will insure that.
1123   //! and then multiplies by the weights
1124   //! ththe CacheParameter is where the Cache was
1125   //! constructed the SpanLength is to normalize
1126   //! the polynomial in the cache to avoid bad conditioning
1127   //! effectsis just evaluates the current point
1128   Standard_EXPORT static void CacheD2 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2);
1129   
1130   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1131   //! the method PolesCoefficients.
1132   //! Warning: To be used for Beziercurves ONLY!!!
1133     static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2);
1134   
1135   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1136   //! the method PolesCoefficients.
1137   //! Warning: To be used for Beziercurves ONLY!!!
1138     static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2);
1139   
1140   //! Perform the evaluation of the of the cache
1141   //! the parameter must be normalized between
1142   //! the 0 and 1 for the span.
1143   //! The Cache must be valid when calling this
1144   //! routine. Geom Package will insure that.
1145   //! and then multiplies by the weights
1146   //! this just evaluates the current point
1147   //! the CacheParameter is where the Cache was
1148   //! constructed the SpanLength is to normalize
1149   //! the polynomial in the cache to avoid bad conditioning
1150   //! effects
1151   Standard_EXPORT static void CacheD3 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2, gp_Vec& Vec3);
1152   
1153   //! Perform the evaluation of the Bspline Basis
1154   //! and then multiplies by the weights
1155   //! this just evaluates the current point
1156   //! the parameter must be normalized between
1157   //! the 0 and 1 for the span.
1158   //! The Cache must be valid when calling this
1159   //! routine. Geom Package will insure that.
1160   //! and then multiplies by the weights
1161   //! ththe CacheParameter is where the Cache was
1162   //! constructed the SpanLength is to normalize
1163   //! the polynomial in the cache to avoid bad conditioning
1164   //! effectsis just evaluates the current point
1165   Standard_EXPORT static void CacheD3 (const Standard_Real U, const Standard_Integer Degree, const Standard_Real CacheParameter, const Standard_Real SpanLenght, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2, gp_Vec2d& Vec3);
1166   
1167   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1168   //! the method PolesCoefficients.
1169   //! Warning: To be used for Beziercurves ONLY!!!
1170     static void CoefsD3 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2, gp_Vec& Vec3);
1171   
1172   //! Calls CacheD1 for Bezier  Curves Arrays computed with
1173   //! the method PolesCoefficients.
1174   //! Warning: To be used for Beziercurves ONLY!!!
1175     static void CoefsD3 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2, gp_Vec2d& Vec3);
1176   
1177   //! Perform the evaluation of the Taylor expansion
1178   //! of the Bspline normalized between 0 and 1.
1179   //! If rational computes the homogeneous Taylor expension
1180   //! for the numerator and stores it in CachePoles
1181   Standard_EXPORT static void BuildCache (const Standard_Real U, const Standard_Real InverseOfSpanDomain, const Standard_Boolean PeriodicFlag, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
1182   
1183   //! Perform the evaluation of the Taylor expansion
1184   //! of the Bspline normalized between 0 and 1.
1185   //! If rational computes the homogeneous Taylor expension
1186   //! for the numerator and stores it in CachePoles
1187   Standard_EXPORT static void BuildCache (const Standard_Real U, const Standard_Real InverseOfSpanDomain, const Standard_Boolean PeriodicFlag, const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
1188   
1189   //! Perform the evaluation of the Taylor expansion
1190   //! of the Bspline normalized between 0 and 1.
1191   //! Structure of result optimized for BSplCLib_Cache.
1192   Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1193   
1194   //! Perform the evaluation of the Taylor expansion
1195   //! of the Bspline normalized between 0 and 1.
1196   //! Structure of result optimized for BSplCLib_Cache.
1197   Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt2d& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1198   
1199     static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
1200   
1201   Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
1202   
1203     static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt& CachePoles);
1204   
1205   //! Encapsulation   of  BuildCache    to   perform   the
1206   //! evaluation  of the Taylor expansion for beziercurves
1207   //! at parameter 0.
1208   //! Warning: To be used for Beziercurves ONLY!!!
1209   Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
1210   
1211   //! Returns pointer to statically allocated array representing
1212   //! flat knots for bezier curve of the specified degree.
1213   //! Raises OutOfRange if Degree > MaxDegree()
1214   Standard_EXPORT static const Standard_Real& FlatBezierKnots (const Standard_Integer Degree);
1215   
1216   //! builds the Schoenberg points from the flat knot
1217   //! used to interpolate a BSpline since the
1218   //! BSpline matrix is invertible.
1219   Standard_EXPORT static void BuildSchoenbergPoints (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, TColStd_Array1OfReal& Parameters);
1220   
1221   //! Performs the interpolation of  the data given in
1222   //! the Poles  array  according  to the  requests in
1223   //! ContactOrderArray    that is      :           if
1224   //! ContactOrderArray(i) has value  d it means  that
1225   //! Poles(i)   contains the dth  derivative of  the
1226   //! function to be interpolated. The length L of the
1227   //! following arrays must be the same :
1228   //! Parameters, ContactOrderArray, Poles,
1229   //! The length of FlatKnots is Degree + L + 1
1230   //! Warning:
1231   //! the method used to do that interpolation is
1232   //! gauss elimination WITHOUT pivoting. Thus if the
1233   //! diagonal is not dominant there is no guarantee
1234   //! that the algorithm will work. Nevertheless for
1235   //! Cubic interpolation or interpolation at Scheonberg
1236   //! points the method will work
1237   //! The InversionProblem will report 0 if there was no
1238   //! problem else it will give the index of the faulty
1239   //! pivot
1240   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt& Poles, Standard_Integer& InversionProblem);
1241   
1242   //! Performs the interpolation of  the data given in
1243   //! the Poles  array  according  to the  requests in
1244   //! ContactOrderArray    that is      :           if
1245   //! ContactOrderArray(i) has value  d it means  that
1246   //! Poles(i)   contains the dth  derivative of  the
1247   //! function to be interpolated. The length L of the
1248   //! following arrays must be the same :
1249   //! Parameters, ContactOrderArray, Poles,
1250   //! The length of FlatKnots is Degree + L + 1
1251   //! Warning:
1252   //! the method used to do that interpolation is
1253   //! gauss elimination WITHOUT pivoting. Thus if the
1254   //! diagonal is not dominant there is no guarantee
1255   //! that the algorithm will work. Nevertheless for
1256   //! Cubic interpolation at knots or interpolation at Scheonberg
1257   //! points the method will work.
1258   //! The InversionProblem w
1259   //! ll report 0 if there was no
1260   //! problem else it will give the index of the faulty
1261   //! pivot
1262   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt2d& Poles, Standard_Integer& InversionProblem);
1263   
1264   //! Performs the interpolation of  the data given in
1265   //! the Poles  array  according  to the  requests in
1266   //! ContactOrderArray    that is      :           if
1267   //! ContactOrderArray(i) has value  d it means  that
1268   //! Poles(i)   contains the dth  derivative of  the
1269   //! function to be interpolated. The length L of the
1270   //! following arrays must be the same :
1271   //! Parameters, ContactOrderArray, Poles,
1272   //! The length of FlatKnots is Degree + L + 1
1273   //! Warning:
1274   //! the method used to do that interpolation is
1275   //! gauss elimination WITHOUT pivoting. Thus if the
1276   //! diagonal is not dominant there is no guarantee
1277   //! that the algorithm will work. Nevertheless for
1278   //! Cubic interpolation at knots or interpolation at Scheonberg
1279   //! points the method will work.
1280   //! The InversionProblem will report 0 if there was no
1281   //! problem else it will give the index of the faulty
1282   //! pivot
1283   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt& Poles, TColStd_Array1OfReal& Weights, Standard_Integer& InversionProblem);
1284   
1285   //! Performs the interpolation of  the data given in
1286   //! the Poles  array  according  to the  requests in
1287   //! ContactOrderArray    that is      :           if
1288   //! ContactOrderArray(i) has value  d it means  that
1289   //! Poles(i)   contains the dth  derivative of  the
1290   //! function to be interpolated. The length L of the
1291   //! following arrays must be the same :
1292   //! Parameters, ContactOrderArray, Poles,
1293   //! The length of FlatKnots is Degree + L + 1
1294   //! Warning:
1295   //! the method used to do that interpolation is
1296   //! gauss elimination WITHOUT pivoting. Thus if the
1297   //! diagonal is not dominant there is no guarantee
1298   //! that the algorithm will work. Nevertheless for
1299   //! Cubic interpolation at knots or interpolation at Scheonberg
1300   //! points the method will work.
1301   //! The InversionProblem w
1302   //! ll report 0 if there was no
1303   //! problem else it will give the i
1304   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, TColgp_Array1OfPnt2d& Poles, TColStd_Array1OfReal& Weights, Standard_Integer& InversionProblem);
1305   
1306   //! Performs the interpolation of  the data given in
1307   //! the Poles  array  according  to the  requests in
1308   //! ContactOrderArray    that is      :           if
1309   //! ContactOrderArray(i) has value  d it means  that
1310   //! Poles(i)   contains the dth  derivative of  the
1311   //! function to be interpolated. The length L of the
1312   //! following arrays must be the same :
1313   //! Parameters, ContactOrderArray
1314   //! The length of FlatKnots is Degree + L + 1
1315   //! The  PolesArray   is    an   seen   as    an
1316   //! Array[1..N][1..ArrayDimension] with N = tge length
1317   //! of the parameters array
1318   //! Warning:
1319   //! the method used to do that interpolation is
1320   //! gauss elimination WITHOUT pivoting. Thus if the
1321   //! diagonal is not dominant there is no guarantee
1322   //! that the algorithm will work. Nevertheless for
1323   //! Cubic interpolation or interpolation at Scheonberg
1324   //! points the method will work
1325   //! The InversionProblem will report 0 if there was no
1326   //! problem else it will give the index of the faulty
1327   //! pivot
1328   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Integer& InversionProblem);
1329   
1330   Standard_EXPORT static void Interpolate (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, const TColStd_Array1OfReal& Parameters, const TColStd_Array1OfInteger& ContactOrderArray, const Standard_Integer ArrayDimension, Standard_Real& Poles, Standard_Real& Weights, Standard_Integer& InversionProblem);
1331   
1332   //! Find the new poles which allows  an old point (with a
1333   //! given  u as parameter) to reach a new position
1334   //! Index1 and Index2 indicate the range of poles we can move
1335   //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1336   //! don't enter (1,NbPoles) -> error: rigid move
1337   //! (2, NbPoles-1) -> the ends are enforced
1338   //! (3, NbPoles-2) -> the ends and the tangency are enforced
1339   //! if Problem in BSplineBasis calculation, no change for the curve
1340   //! and FirstIndex, LastIndex = 0
1341   Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec2d& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt2d& NewPoles);
1342   
1343   //! Find the new poles which allows  an old point (with a
1344   //! given  u as parameter) to reach a new position
1345   //! Index1 and Index2 indicate the range of poles we can move
1346   //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1347   //! don't enter (1,NbPoles) -> error: rigid move
1348   //! (2, NbPoles-1) -> the ends are enforced
1349   //! (3, NbPoles-2) -> the ends and the tangency are enforced
1350   //! if Problem in BSplineBasis calculation, no change for the curve
1351   //! and FirstIndex, LastIndex = 0
1352   Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt& NewPoles);
1353   
1354   //! This is the dimension free version of the utility
1355   //! U is the parameter  must be within the  first FlatKnots and the
1356   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1357   //! DeltaDerivative is the  amount the derivative  has to be moved.
1358   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1359   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1360   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1361   //! -1 means the starting point of the curve can move
1362   //! = 0 means the
1363   //! starting  point  of the curve  cannot  move but  tangent  starting
1364   //! point of the curve cannot move
1365   //! = 1 means the starting point and tangents cannot move
1366   //! = 2 means the starting point tangent and curvature cannot move
1367   //! = ...
1368   //! Same holds for EndingCondition
1369   //! Poles are the poles of the curve
1370   //! Weights are the weights of the curve if not NULL
1371   //! NewPoles are the poles of the deformed curve
1372   //! ErrorStatus will be 0 if no error happened
1373   //! 1 if there are not enough knots/poles
1374   //! the imposed conditions
1375   //! The way to solve this problem is to add knots to the BSpline
1376   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1377   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1378   //! have at least 2 internal knots.
1379   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const Standard_Integer ArrayDimension, Standard_Real& Delta, Standard_Real& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Real& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Real& NewPoles, Standard_Integer& ErrorStatus);
1380   
1381   //! This is the dimension free version of the utility
1382   //! U is the parameter  must be within the  first FlatKnots and the
1383   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1384   //! DeltaDerivative is the  amount the derivative  has to be moved.
1385   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1386   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1387   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1388   //! -1 means the starting point of the curve can move
1389   //! = 0 means the
1390   //! starting  point  of the curve  cannot  move but  tangent  starting
1391   //! point of the curve cannot move
1392   //! = 1 means the starting point and tangents cannot move
1393   //! = 2 means the starting point tangent and curvature cannot move
1394   //! = ...
1395   //! Same holds for EndingCondition
1396   //! Poles are the poles of the curve
1397   //! Weights are the weights of the curve if not NULL
1398   //! NewPoles are the poles of the deformed curve
1399   //! ErrorStatus will be 0 if no error happened
1400   //! 1 if there are not enough knots/poles
1401   //! the imposed conditions
1402   //! The way to solve this problem is to add knots to the BSpline
1403   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1404   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1405   //! have at least 2 internal knots.
1406   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec& Delta, const gp_Vec& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt& NewPoles, Standard_Integer& ErrorStatus);
1407   
1408   //! This is the dimension free version of the utility
1409   //! U is the parameter  must be within the  first FlatKnots and the
1410   //! last FlatKnots  Delta is the amount the  curve has  to be moved
1411   //! DeltaDerivative is the  amount the derivative  has to be moved.
1412   //! Delta  and   DeltaDerivative   must be    array   of  dimension
1413   //! ArrayDimension  Degree  is the degree  of   the BSpline and the
1414   //! FlatKnots are the knots of the BSpline  Starting Condition if =
1415   //! -1 means the starting point of the curve can move
1416   //! = 0 means the
1417   //! starting  point  of the curve  cannot  move but  tangent  starting
1418   //! point of the curve cannot move
1419   //! = 1 means the starting point and tangents cannot move
1420   //! = 2 means the starting point tangent and curvature cannot move
1421   //! = ...
1422   //! Same holds for EndingCondition
1423   //! Poles are the poles of the curve
1424   //! Weights are the weights of the curve if not NULL
1425   //! NewPoles are the poles of the deformed curve
1426   //! ErrorStatus will be 0 if no error happened
1427   //! 1 if there are not enough knots/poles
1428   //! the imposed conditions
1429   //! The way to solve this problem is to add knots to the BSpline
1430   //! If StartCondition = 1 and EndCondition = 1 then you need at least
1431   //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1432   //! have at least 2 internal knots.
1433   Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec2d& Delta, const gp_Vec2d& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& ErrorStatus);
1434   
1435
1436   //! given a tolerance in 3D space returns a
1437   //! tolerance    in U parameter space such that
1438   //! all u1 and u0 in the domain of the curve f(u)
1439   //! | u1 - u0 | < UTolerance and
1440   //! we have |f (u1) - f (u0)| < Tolerance3D
1441   Standard_EXPORT static void Resolution (Standard_Real& PolesArray, const Standard_Integer ArrayDimension, const Standard_Integer NumPoles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1442   
1443
1444   //! given a tolerance in 3D space returns a
1445   //! tolerance    in U parameter space such that
1446   //! all u1 and u0 in the domain of the curve f(u)
1447   //! | u1 - u0 | < UTolerance and
1448   //! we have |f (u1) - f (u0)| < Tolerance3D
1449   Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1450   
1451
1452   //! given a tolerance in 3D space returns a
1453   //! tolerance    in U parameter space such that
1454   //! all u1 and u0 in the domain of the curve f(u)
1455   //! | u1 - u0 | < UTolerance and
1456   //! we have |f (u1) - f (u0)| < Tolerance3D
1457   Standard_EXPORT static void Resolution (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Integer NumPoles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer Degree, const Standard_Real Tolerance3D, Standard_Real& UTolerance);
1458
1459   //! Splits the given range to BSpline intervals of given continuity
1460   //! @param[in] theKnots the knots of BSpline
1461   //! @param[in] theMults the knots' multiplicities
1462   //! @param[in] theDegree the degree of BSpline
1463   //! @param[in] isPeriodic the periodicity of BSpline
1464   //! @param[in] theContinuity the target interval's continuity 
1465   //! @param[in] theFirst the begin of the target range
1466   //! @param[in] theLast the end of the target range
1467   //! @param[in] theTolerance the tolerance
1468   //! @param[in,out] theIntervals the array to store intervals if isn't nullptr
1469   //! @return the number of intervals
1470   Standard_EXPORT static Standard_Integer Intervals (const TColStd_Array1OfReal& theKnots,
1471                                                      const TColStd_Array1OfInteger& theMults,
1472                                                      Standard_Integer theDegree,
1473                                                      Standard_Boolean isPeriodic,
1474                                                      Standard_Integer theContinuity,
1475                                                      Standard_Real theFirst,
1476                                                      Standard_Real theLast,
1477                                                      Standard_Real theTolerance,
1478                                                      TColStd_Array1OfReal* theIntervals);
1479
1480 protected:
1481
1482
1483
1484
1485
1486 private:
1487
1488   
1489   Standard_EXPORT static void LocateParameter (const TColStd_Array1OfReal& Knots, const Standard_Real U, const Standard_Boolean Periodic, const Standard_Integer K1, const Standard_Integer K2, Standard_Integer& Index, Standard_Real& NewU, const Standard_Real Uf, const Standard_Real Ue);
1490
1491
1492
1493
1494 };
1495
1496
1497 #include <BSplCLib.lxx>
1498
1499
1500
1501
1502
1503 #endif // _BSplCLib_HeaderFile