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