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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BSplCLib_HeaderFile
18 #define _BSplCLib_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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>
45 //! BSplCLib B-spline curve Library.
47 //! The BSplCLib package is a basic library for BSplines. It
48 //! provides three categories of functions.
50 //! * Management methods to process knots and multiplicities.
52 //! * Multi-Dimensions spline methods. BSpline methods where
53 //! poles have an arbitrary number of dimensions. They divides
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.
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.
64 //! * 2D and 3D spline curves methods.
66 //! Methods for 2d and 3d BSplines curves rational or not
69 //! Those methods have the following structure :
71 //! - They extract the pole information in a working array.
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).
77 //! - They get back the result in the original dimension.
79 //! Note that the bspline surface methods found in the
80 //! package BSplSLib uses the same structure and rely on
83 //! In the following list of methods the 2d and 3d curve
84 //! methods will be described with the corresponding
85 //! multi-dimension method.
87 //! The 3d or 2d B-spline curve is defined with :
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
97 //! The bounds of Poles and Weights should be the same.
98 //! The bounds of Knots and Mults should be the same.
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.
104 //! No weights (BSplCLib::NoWeights()) means the curve is non rational.
105 //! No mults (BSplCLib::NoMults()) means the knots are "flat" knots.
108 //! B-spline curve, Functions, Library
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
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
124 DEFINE_STANDARD_ALLOC
127 //! This routine searches the position of the real value theX
128 //! in the monotonically increasing set of real values theArray using bisection algorithm.
130 //! If the given value is out of range or array values, algorithm returns either
131 //! theArray.Lower()-1 or theArray.Upper()+1 depending on theX position in the ordered set.
133 //! This routine is used to locate a knot value in a set of knots.
134 Standard_EXPORT static void Hunt (const TColStd_Array1OfReal& theArray,
135 const Standard_Real theX,
136 Standard_Integer& theXPos);
138 //! Computes the index of the knots value which gives
139 //! the start point of the curve.
140 Standard_EXPORT static Standard_Integer FirstUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
142 //! Computes the index of the knots value which gives
143 //! the end point of the curve.
144 Standard_EXPORT static Standard_Integer LastUKnotIndex (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults);
146 //! Computes the index of the flats knots sequence
147 //! corresponding to <Index> in the knots sequence
148 //! which multiplicities are <Mults>.
149 Standard_EXPORT static Standard_Integer FlatIndex (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic);
151 //! Locates the parametric value U in the knots
152 //! sequence between the knot K1 and the knot K2.
153 //! The value return in Index verifies.
155 //! Knots(Index) <= U < Knots(Index + 1)
156 //! if U <= Knots (K1) then Index = K1
157 //! if U >= Knots (K2) then Index = K2 - 1
159 //! If Periodic is True U may be modified to fit in
160 //! the range Knots(K1), Knots(K2). In any case the
161 //! correct value is returned in NewU.
163 //! Warnings :Index is used as input data to initialize the
164 //! searching function.
165 //! Warning: Knots have to be "withe repetitions"
166 Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
168 //! Locates the parametric value U in the knots
169 //! sequence between the knot K1 and the knot K2.
170 //! The value return in Index verifies.
172 //! Knots(Index) <= U < Knots(Index + 1)
173 //! if U <= Knots (K1) then Index = K1
174 //! if U >= Knots (K2) then Index = K2 - 1
176 //! If Periodic is True U may be modified to fit in
177 //! the range Knots(K1), Knots(K2). In any case the
178 //! correct value is returned in NewU.
180 //! Warnings :Index is used as input data to initialize the
181 //! searching function.
182 //! Warning: Knots have to be "flat"
183 Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const Standard_Real U, const Standard_Boolean IsPeriodic, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Integer& KnotIndex, Standard_Real& NewU);
185 Standard_EXPORT static void LocateParameter (const Standard_Integer Degree, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, const Standard_Real U, const Standard_Boolean Periodic, Standard_Integer& Index, Standard_Real& NewU);
187 //! Finds the greatest multiplicity in a set of knots
188 //! between K1 and K2. Mults is the multiplicity
189 //! associated with each knot value.
190 Standard_EXPORT static Standard_Integer MaxKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
192 //! Finds the lowest multiplicity in a set of knots
193 //! between K1 and K2. Mults is the multiplicity
194 //! associated with each knot value.
195 Standard_EXPORT static Standard_Integer MinKnotMult (const TColStd_Array1OfInteger& Mults, const Standard_Integer K1, const Standard_Integer K2);
197 //! Returns the number of poles of the curve. Returns 0 if
198 //! one of the multiplicities is incorrect.
202 //! * Greater than Degree, or Degree+1 at the first and
203 //! last knot of a non periodic curve.
205 //! * The last periodicity on a periodic curve is not
206 //! equal to the first.
207 Standard_EXPORT static Standard_Integer NbPoles (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
209 //! Returns the length of the sequence of knots with
214 //! Sum(Mults(i), i = Mults.Lower(); i <= Mults.Upper());
218 //! Sum(Mults(i); i = Mults.Lower(); i < Mults.Upper())
220 Standard_EXPORT static Standard_Integer KnotSequenceLength (const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic);
222 Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
224 //! Computes the sequence of knots KnotSeq with
225 //! repetition of the knots of multiplicity greater
228 //! Length of KnotSeq must be KnotSequenceLength(Mults,Degree,Periodic)
229 Standard_EXPORT static void KnotSequence (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Integer Degree, const Standard_Boolean Periodic, TColStd_Array1OfReal& KnotSeq);
231 //! Returns the length of the sequence of knots (and
232 //! Mults) without repetition.
233 Standard_EXPORT static Standard_Integer KnotsLength (const TColStd_Array1OfReal& KnotSeq, const Standard_Boolean Periodic = Standard_False);
235 //! Computes the sequence of knots Knots without
236 //! repetition of the knots of multiplicity greater
239 //! Length of <Knots> and <Mults> must be
240 //! KnotsLength(KnotSequence,Periodic)
241 Standard_EXPORT static void Knots (const TColStd_Array1OfReal& KnotSeq, TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults, const Standard_Boolean Periodic = Standard_False);
243 //! Analyses if the knots distribution is "Uniform"
244 //! or "NonUniform" between the knot FromK1 and the
245 //! knot ToK2. There is no repetition of knot in the
246 //! knots'sequence <Knots>.
247 Standard_EXPORT static BSplCLib_KnotDistribution KnotForm (const TColStd_Array1OfReal& Knots, const Standard_Integer FromK1, const Standard_Integer ToK2);
250 //! Analyses the distribution of multiplicities between
251 //! the knot FromK1 and the Knot ToK2.
252 Standard_EXPORT static BSplCLib_MultDistribution MultForm (const TColStd_Array1OfInteger& Mults, const Standard_Integer FromK1, const Standard_Integer ToK2);
254 //! Analyzes the array of knots.
255 //! Returns the form and the maximum knot multiplicity.
256 Standard_EXPORT static void KnotAnalysis (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& CKnots, const TColStd_Array1OfInteger& CMults, GeomAbs_BSplKnotDistribution& KnotForm, Standard_Integer& MaxKnotMult);
259 //! Reparametrizes a B-spline curve to [U1, U2].
260 //! The knot values are recomputed such that Knots (Lower) = U1
261 //! and Knots (Upper) = U2 but the knot form is not modified.
263 //! In the array Knots the values must be in ascending order.
264 //! U1 must not be equal to U2 to avoid division by zero.
265 Standard_EXPORT static void Reparametrize (const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& Knots);
267 //! Reverses the array knots to become the knots
268 //! sequence of the reversed curve.
269 Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Knots);
271 //! Reverses the array of multiplicities.
272 Standard_EXPORT static void Reverse (TColStd_Array1OfInteger& Mults);
274 //! Reverses the array of poles. Last is the index of
275 //! the new first pole. On a non periodic curve last
276 //! is Poles.Upper(). On a periodic curve last is
278 //! (number of flat knots - degree - 1)
282 //! (sum of multiplicities(but for the last) + degree
284 Standard_EXPORT static void Reverse (TColgp_Array1OfPnt& Poles, const Standard_Integer Last);
286 //! Reverses the array of poles.
287 Standard_EXPORT static void Reverse (TColgp_Array1OfPnt2d& Poles, const Standard_Integer Last);
289 //! Reverses the array of poles.
290 Standard_EXPORT static void Reverse (TColStd_Array1OfReal& Weights, const Standard_Integer Last);
293 //! Returns False if all the weights of the array <Weights>
294 //! between I1 an I2 are identic. Epsilon is used for
295 //! comparing weights. If Epsilon is 0. the Epsilon of the
296 //! first weight is used.
297 Standard_EXPORT static Standard_Boolean IsRational (const TColStd_Array1OfReal& Weights, const Standard_Integer I1, const Standard_Integer I2, const Standard_Real Epsilon = 0.0);
299 //! returns the degree maxima for a BSplineCurve.
300 static Standard_Integer MaxDegree();
302 //! Perform the Boor algorithm to evaluate a point at
303 //! parameter <U>, with <Degree> and <Dimension>.
305 //! Poles is an array of Reals of size
307 //! <Dimension> * <Degree>+1
309 //! Containing the poles. At the end <Poles> contains
310 //! the current point.
311 Standard_EXPORT static void Eval (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
313 //! Performs the Boor Algorithm at parameter <U> with
314 //! the given <Degree> and the array of <Knots> on the
315 //! poles <Poles> of dimension <Dimension>. The schema
316 //! is computed until level <Depth> on a basis of
317 //! <Length+1> poles.
319 //! * Knots is an array of reals of length :
321 //! <Length> + <Degree>
323 //! * Poles is an array of reals of length :
325 //! (2 * <Length> + 1) * <Dimension>
327 //! The poles values must be set in the array at the
340 //! The results are found in the array poles depending
341 //! on the Depth. (See the method GetPole).
342 Standard_EXPORT static void BoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length);
344 //! Compute the content of Pole before the BoorScheme.
345 //! This method is used to remove poles.
347 //! U is the poles to remove, Knots should contains the
348 //! knots of the curve after knot removal.
350 //! The first and last poles do not change, the other
351 //! poles are computed by averaging two possible values.
352 //! The distance between the two possible poles is
353 //! computed, if it is higher than <Tolerance> False is
355 Standard_EXPORT static Standard_Boolean AntiBoorScheme (const Standard_Real U, const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles, const Standard_Integer Depth, const Standard_Integer Length, const Standard_Real Tolerance);
357 //! Computes the poles of the BSpline giving the
358 //! derivatives of order <Order>.
360 //! The formula for the first order is
362 //! Pole(i) = Degree * (Pole(i+1) - Pole(i)) /
363 //! (Knots(i+Degree+1) - Knots(i+1))
365 //! This formula is repeated (Degree is decremented at
367 Standard_EXPORT static void Derivative (const Standard_Integer Degree, Standard_Real& Knots, const Standard_Integer Dimension, const Standard_Integer Length, const Standard_Integer Order, Standard_Real& Poles);
369 //! Performs the Bohm Algorithm at parameter <U>. This
370 //! algorithm computes the value and all the derivatives
371 //! up to order N (N <= Degree).
373 //! <Poles> is the original array of poles.
375 //! The result in <Poles> is the value and the
376 //! derivatives. Poles[0] is the value, Poles[Degree]
377 //! is the last derivative.
378 Standard_EXPORT static void Bohm (const Standard_Real U, const Standard_Integer Degree, const Standard_Integer N, Standard_Real& Knots, const Standard_Integer Dimension, Standard_Real& Poles);
380 //! Used as argument for a non rational curve.
381 static TColStd_Array1OfReal* NoWeights();
383 //! Used as argument for a flatknots evaluation.
384 static TColStd_Array1OfInteger* NoMults();
386 //! Stores in LK the usefull knots for the BoorSchem
387 //! on the span Knots(Index) - Knots(Index+1)
388 Standard_EXPORT static void BuildKnots (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& LK);
390 //! Return the index of the first Pole to use on the
391 //! span Mults(Index) - Mults(Index+1). This index
392 //! must be added to Poles.Lower().
393 Standard_EXPORT static Standard_Integer PoleIndex (const Standard_Integer Degree, const Standard_Integer Index, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
395 Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
397 Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
399 //! Copy in <LP> the poles and weights for the Eval
400 //! scheme. starting from Poles(Poles.Lower()+Index)
401 Standard_EXPORT static void BuildEval (const Standard_Integer Degree, const Standard_Integer Index, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, Standard_Real& LP);
403 //! Copy in <LP> poles for <Dimension> Boor scheme.
404 //! Starting from <Index> * <Dimension>, copy
405 //! <Length+1> poles.
406 Standard_EXPORT static void BuildBoor (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, Standard_Real& LP);
408 //! Returns the index in the Boor result array of the
409 //! poles <Index>. If the Boor algorithm was perform
410 //! with <Length> and <Depth>.
411 Standard_EXPORT static Standard_Integer BoorIndex (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth);
413 //! Copy the pole at position <Index> in the Boor
414 //! scheme of dimension <Dimension> to <Position> in
415 //! the array <Pole>. <Position> is updated.
416 Standard_EXPORT static void GetPole (const Standard_Integer Index, const Standard_Integer Length, const Standard_Integer Depth, const Standard_Integer Dimension, Standard_Real& LocPoles, Standard_Integer& Position, TColStd_Array1OfReal& Pole);
418 //! Returns in <NbPoles, NbKnots> the new number of poles
419 //! and knots if the sequence of knots <AddKnots,
420 //! AddMults> is inserted in the sequence <Knots, Mults>.
422 //! Epsilon is used to compare knots for equality.
424 //! If Add is True the multiplicities on equal knots are
427 //! If Add is False the max value of the multiplicities is
430 //! Return False if :
431 //! The knew knots are knot increasing.
432 //! The new knots are not in the range.
433 Standard_EXPORT static Standard_Boolean PrepareInsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, Standard_Integer& NbPoles, Standard_Integer& NbKnots, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
435 Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
437 Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
439 //! Insert a sequence of knots <AddKnots> with
440 //! multiplicities <AddMults>. <AddKnots> must be a non
441 //! decreasing sequence and verifies :
443 //! Knots(Knots.Lower()) <= AddKnots(AddKnots.Lower())
444 //! Knots(Knots.Upper()) >= AddKnots(AddKnots.Upper())
446 //! The NewPoles and NewWeights arrays must have a length :
447 //! Poles.Length() + Sum(AddMults())
449 //! When a knot to insert is identic to an existing knot the
450 //! multiplicities are added.
452 //! Epsilon is used to test knots for equality.
454 //! When AddMult is negative or null the knot is not inserted.
455 //! No multiplicity will becomes higher than the degree.
457 //! The new Knots and Multiplicities are copied in <NewKnots>
460 //! All the New arrays should be correctly dimensioned.
462 //! When all the new knots are existing knots, i.e. only the
463 //! multiplicities will change it is safe to use the same
464 //! arrays as input and output.
465 Standard_EXPORT static void InsertKnots (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& AddKnots, const TColStd_Array1OfInteger* AddMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Epsilon, const Standard_Boolean Add = Standard_True);
467 Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
469 //! Insert a new knot U of multiplicity UMult in the
472 //! The location of the new Knot should be given as an input
473 //! data. UIndex locates the new knot U in the knot sequence
474 //! and Knots (UIndex) < U < Knots (UIndex + 1).
476 //! The new control points corresponding to this insertion are
477 //! returned. Knots and Mults are not updated.
478 Standard_EXPORT static void InsertKnot (const Standard_Integer UIndex, const Standard_Real U, const Standard_Integer UMult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
480 Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
482 //! Raise the multiplicity of knot to <UMult>.
484 //! The new control points are returned. Knots and Mults are
486 Standard_EXPORT static void RaiseMultiplicity (const Standard_Integer KnotIndex, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
488 Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
490 Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
492 //! Decrement the multiplicity of <Knots(Index)>
493 //! to <Mult>. If <Mult> is null the knot is
496 //! As there are two ways to compute the new poles
497 //! the midlle will be used as long as the
498 //! distance is lower than Tolerance.
500 //! If a distance is bigger than tolerance the
501 //! methods returns False and the new arrays are
504 //! A low tolerance can be used to test if the
505 //! knot can be removed without modifying the
508 //! A high tolerance can be used to "smooth" the
510 Standard_EXPORT static Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer Mult, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, const Standard_Real Tolerance);
512 //! Returns the number of knots of a curve with
513 //! multiplicities <Mults> after elevating the degree from
514 //! <Degree> to <NewDegree>. See the IncreaseDegree method
515 //! for more comments.
516 Standard_EXPORT static Standard_Integer IncreaseDegreeCountKnots (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColStd_Array1OfInteger& Mults);
518 Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColStd_Array1OfReal& NewPoles, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
520 Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
522 Standard_EXPORT static void IncreaseDegree (const Standard_Integer Degree, const Standard_Integer NewDegree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults);
524 Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
526 //! Increase the degree of a bspline (or bezier) curve
527 //! of dimension <Dimension> form <Degree> to
530 //! The number of poles in the new curve is :
532 //! Poles.Length() + (NewDegree - Degree) * Number of spans
534 //! Where the number of spans is :
536 //! LastUKnotIndex(Mults) - FirstUKnotIndex(Mults) + 1
538 //! for a non-periodic curve
540 //! And Knots.Length() - 1 for a periodic curve.
542 //! The multiplicities of all knots are increased by
543 //! the degree elevation.
545 //! The new knots are usually the same knots with the
546 //! exception of a non-periodic curve with the first
547 //! and last multiplicity not equal to Degree+1 where
548 //! knots are removed form the start and the bottom
549 //! untils the sum of the multiplicities is equal to
550 //! NewDegree+1 at the knots corresponding to the
551 //! first and last parameters of the curve.
553 //! Example : Suppose a curve of degree 3 starting
554 //! with following knots and multiplicities :
559 //! The FirstUKnot is 2. because the sum of
560 //! multiplicities is Degree+1 : 1 + 2 + 1 = 4 = 3 + 1
562 //! i.e. the first parameter of the curve is 2. and
563 //! will still be 2. after degree elevation. Let
564 //! raises this curve to degree 4. The multiplicities
565 //! are increased by 2.
567 //! They become 2 3 2. But we need a sum of
568 //! multiplicities of 5 at knot 2. So the first knot
569 //! is removed and the new knots are :
574 //! The multipicity of the first knot may also be
575 //! reduced if the sum is still to big.
577 //! In the most common situations (periodic curve or
578 //! curve with first and last multiplicities equals to
579 //! Degree+1) the knots are knot changes.
581 //! The method IncreaseDegreeCountKnots can be used to
582 //! compute the new number of knots.
583 Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
585 //! Set in <NbKnots> and <NbPolesToAdd> the number of Knots and
586 //! Poles of the NotPeriodic Curve identical at the
587 //! periodic curve with a degree <Degree> , a
588 //! knots-distribution with Multiplicities <Mults>.
589 Standard_EXPORT static void PrepareUnperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
591 Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const Standard_Integer Dimension, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfReal& Poles, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfReal& NewPoles);
593 Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
595 Standard_EXPORT static void Unperiodize (const Standard_Integer Degree, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Knots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewKnots, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
597 //! Set in <NbKnots> and <NbPoles> the number of Knots and
598 //! Poles of the curve resulting of the trimming of the
599 //! BSplinecurve definded with <degree>, <knots>, <mults>
600 Standard_EXPORT static void PrepareTrimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real U1, const Standard_Real U2, Standard_Integer& NbKnots, Standard_Integer& NbPoles);
602 Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const Standard_Integer Dimension, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColStd_Array1OfReal& Poles, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColStd_Array1OfReal& NewPoles);
604 Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
606 Standard_EXPORT static void Trimming (const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const Standard_Real U1, const Standard_Real U2, TColStd_Array1OfReal& NewKnots, TColStd_Array1OfInteger& NewMults, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
608 Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P);
610 Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P);
612 Standard_EXPORT static void D0 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P);
614 Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P);
616 Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P);
618 Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V);
620 Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V);
622 Standard_EXPORT static void D1 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V);
624 Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V);
626 Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V);
628 Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2);
630 Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
632 Standard_EXPORT static void D2 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
634 Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2);
636 Standard_EXPORT static void D2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2);
638 Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& P, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3);
640 Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
642 Standard_EXPORT static void D3 (const Standard_Real U, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
644 Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V1, gp_Vec& V2, gp_Vec& V3);
646 Standard_EXPORT static void D3 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3);
648 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, Standard_Real& VN);
650 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer Index, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec& VN);
652 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const Standard_Integer UIndex, const Standard_Integer Degree, const Standard_Boolean Periodic, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger* Mults, gp_Vec2d& V);
654 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt& P, gp_Vec& VN);
656 //! The above functions compute values and
657 //! derivatives in the following situations :
661 //! * Rational or not Rational.
663 //! * Knots and multiplicities or "flat knots" without
666 //! * The <Index> is the the localization of the
667 //! parameter in the knot sequence. If <Index> is out
668 //! of range the correct value will be searched.
670 //! VERY IMPORTANT!!!
671 //! USE BSplCLib::NoWeights() as Weights argument for non
672 //! rational curves computations.
673 Standard_EXPORT static void DN (const Standard_Real U, const Standard_Integer N, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& Weights, gp_Pnt2d& P, gp_Vec2d& VN);
675 //! This evaluates the Bspline Basis at a
676 //! given parameter Parameter up to the
677 //! requested DerivativeOrder and store the
678 //! result in the array BsplineBasis in the
679 //! following fashion
680 //! BSplineBasis(1,1) =
681 //! value of first non vanishing
682 //! Bspline function which has Index FirstNonZeroBsplineIndex
683 //! BsplineBasis(1,2) =
684 //! value of second non vanishing
685 //! Bspline function which has Index
686 //! FirstNonZeroBsplineIndex + 1
687 //! BsplineBasis(1,n) =
688 //! value of second non vanishing non vanishing
689 //! Bspline function which has Index
690 //! FirstNonZeroBsplineIndex + n (n <= Order)
691 //! BSplineBasis(2,1) =
692 //! value of derivative of first non vanishing
693 //! Bspline function which has Index FirstNonZeroBsplineIndex
694 //! BSplineBasis(N,1) =
695 //! value of Nth derivative of first non vanishing
696 //! Bspline function which has Index FirstNonZeroBsplineIndex
697 //! if N <= DerivativeOrder + 1
698 Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer DerivativeOrder,
699 const Standard_Integer Order,
700 const TColStd_Array1OfReal& FlatKnots,
701 const Standard_Real Parameter,
702 Standard_Integer& FirstNonZeroBsplineIndex,
703 math_Matrix& BsplineBasis,
704 const Standard_Boolean isPeriodic = Standard_False);
706 //! This Builds a fully blown Matrix of
710 //! with i and j within 1..Order + NumPoles
711 //! The integer ni is the ith slot of the
712 //! array OrderArray, tj is the jth slot of
713 //! the array Parameters
714 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 //! this factors the Banded Matrix in
717 //! the LU form with a Banded storage of
718 //! components of the L matrix
719 //! WARNING : do not use if the Matrix is
720 //! totally positive (It is the case for
721 //! Bspline matrices build as above with
722 //! parameters being the Schoenberg points
723 Standard_EXPORT static Standard_Integer FactorBandedMatrix (math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, Standard_Integer& PivotIndexProblem);
725 //! This solves the system Matrix.X = B
726 //! with when Matrix is factored in LU form
727 //! The Array is an seen as an
728 //! Array[1..N][1..ArrayDimension] with N =
729 //! the rank of the matrix Matrix. The
730 //! result is stored in Array when each
731 //! coordinate is solved that is B is the
732 //! array whose values are
733 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
734 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 //! This solves the system Matrix.X = B
737 //! with when Matrix is factored in LU form
738 //! The Array has the length of
739 //! the rank of the matrix Matrix. The
740 //! result is stored in Array when each
741 //! coordinate is solved that is B is the
742 //! array whose values are
743 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
744 Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt2d& Array);
746 //! This solves the system Matrix.X = B
747 //! with when Matrix is factored in LU form
748 //! The Array has the length of
749 //! the rank of the matrix Matrix. The
750 //! result is stored in Array when each
751 //! coordinate is solved that is B is the
752 //! array whose values are
753 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
754 Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt& Array);
756 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 //! This solves the system Matrix.X = B
759 //! with when Matrix is factored in LU form
760 //! The Array is an seen as an
761 //! Array[1..N][1..ArrayDimension] with N =
762 //! the rank of the matrix Matrix. The
763 //! result is stored in Array when each
764 //! coordinate is solved that is B is the
765 //! array whose values are B[i] =
766 //! Array[i][p] for each p in
767 //! 1..ArrayDimension. If HomogeneousFlag ==
768 //! 0 the Poles are multiplied by the
769 //! Weights uppon Entry and once
770 //! interpolation is carried over the
771 //! result of the poles are divided by the
772 //! result of the interpolation of the
773 //! weights. Otherwise if HomogenousFlag == 1
774 //! the Poles and Weigths are treated homogenously
775 //! that is that those are interpolated as they
776 //! are and result is returned without division
777 //! by the interpolated weigths.
778 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 //! This solves the system Matrix.X = B
781 //! with when Matrix is factored in LU form
782 //! The Array is an seen as an
783 //! Array[1..N][1..ArrayDimension] with N =
784 //! the rank of the matrix Matrix. The
785 //! result is stored in Array when each
786 //! coordinate is solved that is B is the
787 //! array whose values are
788 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
789 //! If HomogeneousFlag ==
790 //! 0 the Poles are multiplied by the
791 //! Weights uppon Entry and once
792 //! interpolation is carried over the
793 //! result of the poles are divided by the
794 //! result of the interpolation of the
795 //! weights. Otherwise if HomogenousFlag == 1
796 //! the Poles and Weigths are treated homogenously
797 //! that is that those are interpolated as they
798 //! are and result is returned without division
799 //! by the interpolated weigths.
800 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 //! Merges two knot vector by setting the starting and
803 //! ending values to StartValue and EndValue
804 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 //! This function will compose a given Vectorial BSpline F(t)
807 //! defined by its BSplineDegree and BSplineFlatKnotsl,
808 //! its Poles array which are coded as an array of Real
809 //! of the form [1..NumPoles][1..PolesDimension] with a
810 //! function a(t) which is assumed to satisfy the
813 //! 1. F(a(t)) is a polynomial BSpline
814 //! that can be expressed exactly as a BSpline of degree
815 //! NewDegree on the knots FlatKnots
817 //! 2. a(t) defines a differentiable
818 //! isomorphism between the range of FlatKnots to the range
819 //! of BSplineFlatKnots which is the
820 //! same as the range of F(t)
823 //! the caller's responsibility to insure that conditions
824 //! 1. and 2. above are satisfied : no check whatsoever
825 //! is made in this method
827 //! theStatus will return 0 if OK else it will return the pivot index
828 //! of the matrix that was inverted to compute the multiplied
829 //! BSpline : the method used is interpolation at Schoenenberg
830 //! points of F(a(t))
831 Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
833 //! This function will compose a given Vectorial BSpline F(t)
834 //! defined by its BSplineDegree and BSplineFlatKnotsl,
835 //! its Poles array which are coded as an array of Real
836 //! of the form [1..NumPoles][1..PolesDimension] with a
837 //! function a(t) which is assumed to satisfy the
840 //! 1. F(a(t)) is a polynomial BSpline
841 //! that can be expressed exactly as a BSpline of degree
842 //! NewDegree on the knots FlatKnots
844 //! 2. a(t) defines a differentiable
845 //! isomorphism between the range of FlatKnots to the range
846 //! of BSplineFlatKnots which is the
847 //! same as the range of F(t)
850 //! the caller's responsibility to insure that conditions
851 //! 1. and 2. above are satisfied : no check whatsoever
852 //! is made in this method
854 //! theStatus will return 0 if OK else it will return the pivot index
855 //! of the matrix that was inverted to compute the multiplied
856 //! BSpline : the method used is interpolation at Schoenenberg
857 //! points of F(a(t))
858 Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
860 //! this will compose a given Vectorial BSpline F(t)
861 //! defined by its BSplineDegree and BSplineFlatKnotsl,
862 //! its Poles array which are coded as an array of Real
863 //! of the form [1..NumPoles][1..PolesDimension] with a
864 //! function a(t) which is assumed to satisfy the
865 //! following : 1. F(a(t)) is a polynomial BSpline
866 //! that can be expressed exactly as a BSpline of degree
867 //! NewDegree on the knots FlatKnots
868 //! 2. a(t) defines a differentiable
869 //! isomorphism between the range of FlatKnots to the range
870 //! of BSplineFlatKnots which is the
871 //! same as the range of F(t)
873 //! the caller's responsibility to insure that conditions
874 //! 1. and 2. above are satisfied : no check whatsoever
875 //! is made in this method
876 //! theStatus will return 0 if OK else it will return the pivot index
877 //! of the matrix that was inverted to compute the multiplied
878 //! BSpline : the method used is interpolation at Schoenenberg
879 //! points of F(a(t))
880 Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
882 //! this will compose a given Vectorial BSpline F(t)
883 //! defined by its BSplineDegree and BSplineFlatKnotsl,
884 //! its Poles array which are coded as an array of Real
885 //! of the form [1..NumPoles][1..PolesDimension] with a
886 //! function a(t) which is assumed to satisfy the
887 //! following : 1. F(a(t)) is a polynomial BSpline
888 //! that can be expressed exactly as a BSpline of degree
889 //! NewDegree on the knots FlatKnots
890 //! 2. a(t) defines a differentiable
891 //! isomorphism between the range of FlatKnots to the range
892 //! of BSplineFlatKnots which is the
893 //! same as the range of F(t)
895 //! the caller's responsibility to insure that conditions
896 //! 1. and 2. above are satisfied : no check whatsoever
897 //! is made in this method
898 //! theStatus will return 0 if OK else it will return the pivot index
899 //! of the matrix that was inverted to compute the multiplied
900 //! BSpline : the method used is interpolation at Schoenenberg
901 //! points of F(a(t))
902 Standard_EXPORT static void FunctionReparameterise (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
904 //! this will multiply a given Vectorial BSpline F(t)
905 //! defined by its BSplineDegree and BSplineFlatKnotsl,
906 //! its Poles array which are coded as an array of Real
907 //! of the form [1..NumPoles][1..PolesDimension] by a
908 //! function a(t) which is assumed to satisfy the
909 //! following : 1. a(t) * F(t) is a polynomial BSpline
910 //! that can be expressed exactly as a BSpline of degree
911 //! NewDegree on the knots FlatKnots 2. the range of a(t)
912 //! is the same as the range of F(t)
914 //! the caller's responsibility to insure that conditions
915 //! 1. and 2. above are satisfied : no check whatsoever
916 //! is made in this method
917 //! theStatus will return 0 if OK else it will return the pivot index
918 //! of the matrix that was inverted to compute the multiplied
919 //! BSpline : the method used is interpolation at Schoenenberg
920 //! points of a(t)*F(t)
921 Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const Standard_Integer PolesDimension, Standard_Real& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, Standard_Real& NewPoles, Standard_Integer& theStatus);
923 //! this will multiply a given Vectorial BSpline F(t)
924 //! defined by its BSplineDegree and BSplineFlatKnotsl,
925 //! its Poles array which are coded as an array of Real
926 //! of the form [1..NumPoles][1..PolesDimension] by a
927 //! function a(t) which is assumed to satisfy the
928 //! following : 1. a(t) * F(t) is a polynomial BSpline
929 //! that can be expressed exactly as a BSpline of degree
930 //! NewDegree on the knots FlatKnots 2. the range of a(t)
931 //! is the same as the range of F(t)
933 //! the caller's responsibility to insure that conditions
934 //! 1. and 2. above are satisfied : no check whatsoever
935 //! is made in this method
936 //! theStatus will return 0 if OK else it will return the pivot index
937 //! of the matrix that was inverted to compute the multiplied
938 //! BSpline : the method used is interpolation at Schoenenberg
939 //! points of a(t)*F(t)
940 Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColStd_Array1OfReal& NewPoles, Standard_Integer& theStatus);
942 //! this will multiply a given Vectorial BSpline F(t)
943 //! defined by its BSplineDegree and BSplineFlatKnotsl,
944 //! its Poles array which are coded as an array of Real
945 //! of the form [1..NumPoles][1..PolesDimension] by a
946 //! function a(t) which is assumed to satisfy the
947 //! following : 1. a(t) * F(t) is a polynomial BSpline
948 //! that can be expressed exactly as a BSpline of degree
949 //! NewDegree on the knots FlatKnots 2. the range of a(t)
950 //! is the same as the range of F(t)
952 //! the caller's responsibility to insure that conditions
953 //! 1. and 2. above are satisfied : no check whatsoever
954 //! is made in this method
955 //! theStatus will return 0 if OK else it will return the pivot index
956 //! of the matrix that was inverted to compute the multiplied
957 //! BSpline : the method used is interpolation at Schoenenberg
958 //! points of a(t)*F(t)
959 Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& theStatus);
961 //! this will multiply a given Vectorial BSpline F(t)
962 //! defined by its BSplineDegree and BSplineFlatKnotsl,
963 //! its Poles array which are coded as an array of Real
964 //! of the form [1..NumPoles][1..PolesDimension] by a
965 //! function a(t) which is assumed to satisfy the
966 //! following : 1. a(t) * F(t) is a polynomial BSpline
967 //! that can be expressed exactly as a BSpline of degree
968 //! NewDegree on the knots FlatKnots 2. the range of a(t)
969 //! is the same as the range of F(t)
971 //! the caller's responsibility to insure that conditions
972 //! 1. and 2. above are satisfied : no check whatsoever
973 //! is made in this method
974 //! theStatus will return 0 if OK else it will return the pivot index
975 //! of the matrix that was inverted to compute the multiplied
976 //! BSpline : the method used is interpolation at Schoenenberg
977 //! points of a(t)*F(t)
978 Standard_EXPORT static void FunctionMultiply (const BSplCLib_EvaluatorFunction& Function, const Standard_Integer BSplineDegree, const TColStd_Array1OfReal& BSplineFlatKnots, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal& FlatKnots, const Standard_Integer NewDegree, TColgp_Array1OfPnt& NewPoles, Standard_Integer& theStatus);
980 //! Perform the De Boor algorithm to evaluate a point at
981 //! parameter <U>, with <Degree> and <Dimension>.
983 //! Poles is an array of Reals of size
985 //! <Dimension> * <Degree>+1
987 //! Containing the poles. At the end <Poles> contains
988 //! the current point. Poles Contain all the poles of
989 //! the BsplineCurve, Knots also Contains all the knots
990 //! of the BsplineCurve. ExtrapMode has two slots [0] =
991 //! Degree used to extrapolate before the first knot [1]
992 //! = Degre used to extrapolate after the last knot has
993 //! to be between 1 and Degree
994 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 //! Perform the De Boor algorithm to evaluate a point at
997 //! parameter <U>, with <Degree> and <Dimension>.
998 //! Evaluates by multiplying the Poles by the Weights and
999 //! gives the homogeneous result in PolesResult that is
1000 //! the results of the evaluation of the numerator once it
1001 //! has been multiplied by the weights and in
1002 //! WeightsResult one has the result of the evaluation of
1005 //! Warning: <PolesResult> and <WeightsResult> must be dimensionned
1007 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 //! Perform the evaluation of the Bspline Basis
1010 //! and then multiplies by the weights
1011 //! this just evaluates the current point
1012 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 //! Perform the evaluation of the Bspline Basis
1015 //! and then multiplies by the weights
1016 //! this just evaluates the current point
1017 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 //! Extend a BSpline nD using the tangency map
1020 //! <C1Coefficient> is the coefficient of reparametrisation
1021 //! <Continuity> must be equal to 1, 2 or 3.
1022 //! <Degree> must be greater or equal than <Continuity> + 1.
1024 //! Warning: <KnotsResult> and <PolesResult> must be dimensionned
1026 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 //! Perform the evaluation of the of the cache
1029 //! the parameter must be normalized between
1030 //! the 0 and 1 for the span.
1031 //! The Cache must be valid when calling this
1032 //! routine. Geom Package will insure that.
1033 //! and then multiplies by the weights
1034 //! this just evaluates the current point
1035 //! the CacheParameter is where the Cache was
1036 //! constructed the SpanLength is to normalize
1037 //! the polynomial in the cache to avoid bad conditioning
1039 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 //! Perform the evaluation of the Bspline Basis
1042 //! and then multiplies by the weights
1043 //! this just evaluates the current point
1044 //! the parameter must be normalized between
1045 //! the 0 and 1 for the span.
1046 //! The Cache must be valid when calling this
1047 //! routine. Geom Package will insure that.
1048 //! and then multiplies by the weights
1049 //! ththe CacheParameter is where the Cache was
1050 //! constructed the SpanLength is to normalize
1051 //! the polynomial in the cache to avoid bad conditioning
1052 //! effectsis just evaluates the current point
1053 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 //! Calls CacheD0 for Bezier Curves Arrays computed with
1056 //! the method PolesCoefficients.
1057 //! Warning: To be used for Beziercurves ONLY!!!
1058 static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
1060 //! Calls CacheD0 for Bezier Curves Arrays computed with
1061 //! the method PolesCoefficients.
1062 //! Warning: To be used for Beziercurves ONLY!!!
1063 static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
1065 //! Perform the evaluation of the of the cache
1066 //! the parameter must be normalized between
1067 //! the 0 and 1 for the span.
1068 //! The Cache must be valid when calling this
1069 //! routine. Geom Package will insure that.
1070 //! and then multiplies by the weights
1071 //! this just evaluates the current point
1072 //! the CacheParameter is where the Cache was
1073 //! constructed the SpanLength is to normalize
1074 //! the polynomial in the cache to avoid bad conditioning
1076 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 //! Perform the evaluation of the Bspline Basis
1079 //! and then multiplies by the weights
1080 //! this just evaluates the current point
1081 //! the parameter must be normalized between
1082 //! the 0 and 1 for the span.
1083 //! The Cache must be valid when calling this
1084 //! routine. Geom Package will insure that.
1085 //! and then multiplies by the weights
1086 //! ththe CacheParameter is where the Cache was
1087 //! constructed the SpanLength is to normalize
1088 //! the polynomial in the cache to avoid bad conditioning
1089 //! effectsis just evaluates the current point
1090 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 //! Calls CacheD1 for Bezier Curves Arrays computed with
1093 //! the method PolesCoefficients.
1094 //! Warning: To be used for Beziercurves ONLY!!!
1095 static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
1097 //! Calls CacheD1 for Bezier Curves Arrays computed with
1098 //! the method PolesCoefficients.
1099 //! Warning: To be used for Beziercurves ONLY!!!
1100 static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
1102 //! Perform the evaluation of the of the cache
1103 //! the parameter must be normalized between
1104 //! the 0 and 1 for the span.
1105 //! The Cache must be valid when calling this
1106 //! routine. Geom Package will insure that.
1107 //! and then multiplies by the weights
1108 //! this just evaluates the current point
1109 //! the CacheParameter is where the Cache was
1110 //! constructed the SpanLength is to normalize
1111 //! the polynomial in the cache to avoid bad conditioning
1113 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 //! Perform the evaluation of the Bspline Basis
1116 //! and then multiplies by the weights
1117 //! this just evaluates the current point
1118 //! the parameter must be normalized between
1119 //! the 0 and 1 for the span.
1120 //! The Cache must be valid when calling this
1121 //! routine. Geom Package will insure that.
1122 //! and then multiplies by the weights
1123 //! ththe CacheParameter is where the Cache was
1124 //! constructed the SpanLength is to normalize
1125 //! the polynomial in the cache to avoid bad conditioning
1126 //! effectsis just evaluates the current point
1127 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 //! Calls CacheD1 for Bezier Curves Arrays computed with
1130 //! the method PolesCoefficients.
1131 //! Warning: To be used for Beziercurves ONLY!!!
1132 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 //! Calls CacheD1 for Bezier Curves Arrays computed with
1135 //! the method PolesCoefficients.
1136 //! Warning: To be used for Beziercurves ONLY!!!
1137 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 //! Perform the evaluation of the of the cache
1140 //! the parameter must be normalized between
1141 //! the 0 and 1 for the span.
1142 //! The Cache must be valid when calling this
1143 //! routine. Geom Package will insure that.
1144 //! and then multiplies by the weights
1145 //! this just evaluates the current point
1146 //! the CacheParameter is where the Cache was
1147 //! constructed the SpanLength is to normalize
1148 //! the polynomial in the cache to avoid bad conditioning
1150 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 //! Perform the evaluation of the Bspline Basis
1153 //! and then multiplies by the weights
1154 //! this just evaluates the current point
1155 //! the parameter must be normalized between
1156 //! the 0 and 1 for the span.
1157 //! The Cache must be valid when calling this
1158 //! routine. Geom Package will insure that.
1159 //! and then multiplies by the weights
1160 //! ththe CacheParameter is where the Cache was
1161 //! constructed the SpanLength is to normalize
1162 //! the polynomial in the cache to avoid bad conditioning
1163 //! effectsis just evaluates the current point
1164 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 //! Calls CacheD1 for Bezier Curves Arrays computed with
1167 //! the method PolesCoefficients.
1168 //! Warning: To be used for Beziercurves ONLY!!!
1169 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 //! Calls CacheD1 for Bezier Curves Arrays computed with
1172 //! the method PolesCoefficients.
1173 //! Warning: To be used for Beziercurves ONLY!!!
1174 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 //! Perform the evaluation of the Taylor expansion
1177 //! of the Bspline normalized between 0 and 1.
1178 //! If rational computes the homogeneous Taylor expension
1179 //! for the numerator and stores it in CachePoles
1180 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 //! Perform the evaluation of the Taylor expansion
1183 //! of the Bspline normalized between 0 and 1.
1184 //! If rational computes the homogeneous Taylor expension
1185 //! for the numerator and stores it in CachePoles
1186 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 //! Perform the evaluation of the Taylor expansion
1189 //! of the Bspline normalized between 0 and 1.
1190 //! Structure of result optimized for BSplCLib_Cache.
1191 Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1193 //! Perform the evaluation of the Taylor expansion
1194 //! of the Bspline normalized between 0 and 1.
1195 //! Structure of result optimized for BSplCLib_Cache.
1196 Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt2d& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
1198 static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
1200 Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
1202 static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt& CachePoles);
1204 //! Encapsulation of BuildCache to perform the
1205 //! evaluation of the Taylor expansion for beziercurves
1207 //! Warning: To be used for Beziercurves ONLY!!!
1208 Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
1210 //! Returns pointer to statically allocated array representing
1211 //! flat knots for bezier curve of the specified degree.
1212 //! Raises OutOfRange if Degree > MaxDegree()
1213 Standard_EXPORT static const Standard_Real& FlatBezierKnots (const Standard_Integer Degree);
1215 //! builds the Schoenberg points from the flat knot
1216 //! used to interpolate a BSpline since the
1217 //! BSpline matrix is invertible.
1218 Standard_EXPORT static void BuildSchoenbergPoints (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, TColStd_Array1OfReal& Parameters);
1220 //! Performs the interpolation of the data given in
1221 //! the Poles array according to the requests in
1222 //! ContactOrderArray that is : if
1223 //! ContactOrderArray(i) has value d it means that
1224 //! Poles(i) containes the dth derivative of the
1225 //! function to be interpolated. The length L of the
1226 //! following arrays must be the same :
1227 //! Parameters, ContactOrderArray, Poles,
1228 //! The length of FlatKnots is Degree + L + 1
1230 //! the method used to do that interpolation is
1231 //! gauss elimination WITHOUT pivoting. Thus if the
1232 //! diagonal is not dominant there is no guarantee
1233 //! that the algorithm will work. Nevertheless for
1234 //! Cubic interpolation or interpolation at Scheonberg
1235 //! points the method will work
1236 //! The InversionProblem will report 0 if there was no
1237 //! problem else it will give the index of the faulty
1239 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 //! Performs the interpolation of the data given in
1242 //! the Poles array according to the requests in
1243 //! ContactOrderArray that is : if
1244 //! ContactOrderArray(i) has value d it means that
1245 //! Poles(i) containes the dth derivative of the
1246 //! function to be interpolated. The length L of the
1247 //! following arrays must be the same :
1248 //! Parameters, ContactOrderArray, Poles,
1249 //! The length of FlatKnots is Degree + L + 1
1251 //! the method used to do that interpolation is
1252 //! gauss elimination WITHOUT pivoting. Thus if the
1253 //! diagonal is not dominant there is no guarantee
1254 //! that the algorithm will work. Nevertheless for
1255 //! Cubic interpolation at knots or interpolation at Scheonberg
1256 //! points the method will work.
1257 //! The InversionProblem w
1258 //! ll report 0 if there was no
1259 //! problem else it will give the index of the faulty
1261 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 //! Performs the interpolation of the data given in
1264 //! the Poles array according to the requests in
1265 //! ContactOrderArray that is : if
1266 //! ContactOrderArray(i) has value d it means that
1267 //! Poles(i) containes the dth derivative of the
1268 //! function to be interpolated. The length L of the
1269 //! following arrays must be the same :
1270 //! Parameters, ContactOrderArray, Poles,
1271 //! The length of FlatKnots is Degree + L + 1
1273 //! the method used to do that interpolation is
1274 //! gauss elimination WITHOUT pivoting. Thus if the
1275 //! diagonal is not dominant there is no guarantee
1276 //! that the algorithm will work. Nevertheless for
1277 //! Cubic interpolation at knots or interpolation at Scheonberg
1278 //! points the method will work.
1279 //! The InversionProblem will report 0 if there was no
1280 //! problem else it will give the index of the faulty
1282 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 //! Performs the interpolation of the data given in
1285 //! the Poles array according to the requests in
1286 //! ContactOrderArray that is : if
1287 //! ContactOrderArray(i) has value d it means that
1288 //! Poles(i) containes the dth derivative of the
1289 //! function to be interpolated. The length L of the
1290 //! following arrays must be the same :
1291 //! Parameters, ContactOrderArray, Poles,
1292 //! The length of FlatKnots is Degree + L + 1
1294 //! the method used to do that interpolation is
1295 //! gauss elimination WITHOUT pivoting. Thus if the
1296 //! diagonal is not dominant there is no guarantee
1297 //! that the algorithm will work. Nevertheless for
1298 //! Cubic interpolation at knots or interpolation at Scheonberg
1299 //! points the method will work.
1300 //! The InversionProblem w
1301 //! ll report 0 if there was no
1302 //! problem else it will give the i
1303 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 //! Performs the interpolation of the data given in
1306 //! the Poles array according to the requests in
1307 //! ContactOrderArray that is : if
1308 //! ContactOrderArray(i) has value d it means that
1309 //! Poles(i) containes the dth derivative of the
1310 //! function to be interpolated. The length L of the
1311 //! following arrays must be the same :
1312 //! Parameters, ContactOrderArray
1313 //! The length of FlatKnots is Degree + L + 1
1314 //! The PolesArray is an seen as an
1315 //! Array[1..N][1..ArrayDimension] with N = tge length
1316 //! of the parameters array
1318 //! the method used to do that interpolation is
1319 //! gauss elimination WITHOUT pivoting. Thus if the
1320 //! diagonal is not dominant there is no guarantee
1321 //! that the algorithm will work. Nevertheless for
1322 //! Cubic interpolation or interpolation at Scheonberg
1323 //! points the method will work
1324 //! The InversionProblem will report 0 if there was no
1325 //! problem else it will give the index of the faulty
1327 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 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 //! Find the new poles which allows an old point (with a
1332 //! given u as parameter) to reach a new position
1333 //! Index1 and Index2 indicate the range of poles we can move
1334 //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1335 //! don't enter (1,NbPoles) -> error: rigid move
1336 //! (2, NbPoles-1) -> the ends are enforced
1337 //! (3, NbPoles-2) -> the ends and the tangency are enforced
1338 //! if Problem in BSplineBasis calculation, no change for the curve
1339 //! and FirstIndex, LastIndex = 0
1340 Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec2d& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt2d& NewPoles);
1342 //! Find the new poles which allows an old point (with a
1343 //! given u as parameter) to reach a new position
1344 //! Index1 and Index2 indicate the range of poles we can move
1345 //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1346 //! don't enter (1,NbPoles) -> error: rigid move
1347 //! (2, NbPoles-1) -> the ends are enforced
1348 //! (3, NbPoles-2) -> the ends and the tangency are enforced
1349 //! if Problem in BSplineBasis calculation, no change for the curve
1350 //! and FirstIndex, LastIndex = 0
1351 Standard_EXPORT static void MovePoint (const Standard_Real U, const gp_Vec& Displ, const Standard_Integer Index1, const Standard_Integer Index2, const Standard_Integer Degree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Integer& FirstIndex, Standard_Integer& LastIndex, TColgp_Array1OfPnt& NewPoles);
1353 //! This is the dimension free version of the utility
1354 //! U is the parameter must be within the first FlatKnots and the
1355 //! last FlatKnots Delta is the amount the curve has to be moved
1356 //! DeltaDerivative is the amount the derivative has to be moved.
1357 //! Delta and DeltaDerivative must be array of dimension
1358 //! ArrayDimension Degree is the degree of the BSpline and the
1359 //! FlatKnots are the knots of the BSpline Starting Condition if =
1360 //! -1 means the starting point of the curve can move
1362 //! starting point of the cuve cannot move but tangen starting
1363 //! point of the curve cannot move
1364 //! = 1 means the starting point and tangents cannot move
1365 //! = 2 means the starting point tangent and curvature cannot move
1367 //! Same holds for EndingCondition
1368 //! Poles are the poles of the curve
1369 //! Weights are the weights of the curve if not NULL
1370 //! NewPoles are the poles of the deformed curve
1371 //! ErrorStatus will be 0 if no error happened
1372 //! 1 if there are not enough knots/poles
1373 //! the imposed conditions
1374 //! The way to solve this problem is to add knots to the BSpline
1375 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1376 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1377 //! have at least 2 internal knots.
1378 Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const Standard_Integer ArrayDimension, Standard_Real& Delta, Standard_Real& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Real& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, Standard_Real& NewPoles, Standard_Integer& ErrorStatus);
1380 //! This is the dimension free version of the utility
1381 //! U is the parameter must be within the first FlatKnots and the
1382 //! last FlatKnots Delta is the amount the curve has to be moved
1383 //! DeltaDerivative is the amount the derivative has to be moved.
1384 //! Delta and DeltaDerivative must be array of dimension
1385 //! ArrayDimension Degree is the degree of the BSpline and the
1386 //! FlatKnots are the knots of the BSpline Starting Condition if =
1387 //! -1 means the starting point of the curve can move
1389 //! starting point of the cuve cannot move but tangen starting
1390 //! point of the curve cannot move
1391 //! = 1 means the starting point and tangents cannot move
1392 //! = 2 means the starting point tangent and curvature cannot move
1394 //! Same holds for EndingCondition
1395 //! Poles are the poles of the curve
1396 //! Weights are the weights of the curve if not NULL
1397 //! NewPoles are the poles of the deformed curve
1398 //! ErrorStatus will be 0 if no error happened
1399 //! 1 if there are not enough knots/poles
1400 //! the imposed conditions
1401 //! The way to solve this problem is to add knots to the BSpline
1402 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1403 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1404 //! have at least 2 internal knots.
1405 Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec& Delta, const gp_Vec& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt& NewPoles, Standard_Integer& ErrorStatus);
1407 //! This is the dimension free version of the utility
1408 //! U is the parameter must be within the first FlatKnots and the
1409 //! last FlatKnots Delta is the amount the curve has to be moved
1410 //! DeltaDerivative is the amount the derivative has to be moved.
1411 //! Delta and DeltaDerivative must be array of dimension
1412 //! ArrayDimension Degree is the degree of the BSpline and the
1413 //! FlatKnots are the knots of the BSpline Starting Condition if =
1414 //! -1 means the starting point of the curve can move
1416 //! starting point of the cuve cannot move but tangen starting
1417 //! point of the curve cannot move
1418 //! = 1 means the starting point and tangents cannot move
1419 //! = 2 means the starting point tangent and curvature cannot move
1421 //! Same holds for EndingCondition
1422 //! Poles are the poles of the curve
1423 //! Weights are the weights of the curve if not NULL
1424 //! NewPoles are the poles of the deformed curve
1425 //! ErrorStatus will be 0 if no error happened
1426 //! 1 if there are not enough knots/poles
1427 //! the imposed conditions
1428 //! The way to solve this problem is to add knots to the BSpline
1429 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1430 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1431 //! have at least 2 internal knots.
1432 Standard_EXPORT static void MovePointAndTangent (const Standard_Real U, const gp_Vec2d& Delta, const gp_Vec2d& DeltaDerivative, const Standard_Real Tolerance, const Standard_Integer Degree, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, const TColStd_Array1OfReal& FlatKnots, TColgp_Array1OfPnt2d& NewPoles, Standard_Integer& ErrorStatus);
1435 //! given a tolerance in 3D space returns a
1436 //! tolerance in U parameter space such that
1437 //! all u1 and u0 in the domain of the curve f(u)
1438 //! | u1 - u0 | < UTolerance and
1439 //! we have |f (u1) - f (u0)| < Tolerance3D
1440 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);
1443 //! given a tolerance in 3D space returns a
1444 //! tolerance in U parameter space such that
1445 //! all u1 and u0 in the domain of the curve f(u)
1446 //! | u1 - u0 | < UTolerance and
1447 //! we have |f (u1) - f (u0)| < Tolerance3D
1448 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);
1451 //! given a tolerance in 3D space returns a
1452 //! tolerance in U parameter space such that
1453 //! all u1 and u0 in the domain of the curve f(u)
1454 //! | u1 - u0 | < UTolerance and
1455 //! we have |f (u1) - f (u0)| < Tolerance3D
1456 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);
1470 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);
1478 #include <BSplCLib.lxx>
1484 #endif // _BSplCLib_HeaderFile