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