Warnings on vc14 were eliminated
[occt.git] / src / BSplCLib / BSplCLib.hxx
CommitLineData
42cf5bc1 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>
38class gp_Pnt;
39class gp_Pnt2d;
40class gp_Vec;
41class gp_Vec2d;
42class 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//!
0e14656b 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.
42cf5bc1 103//!
0e14656b 104//! No weights (BSplCLib::NoWeights()) means the curve is non rational.
105//! No mults (BSplCLib::NoMults()) means the knots are "flat" knots.
42cf5bc1 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
120class BSplCLib
121{
122public:
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
0e14656b 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);
42cf5bc1 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.
0e14656b 388 static TColStd_Array1OfReal* NoWeights();
42cf5bc1 389
390 //! Used as argument for a flatknots evaluation.
0e14656b 391 static TColStd_Array1OfInteger* NoMults();
42cf5bc1 392
393 //! Stores in LK the usefull knots for the BoorSchem
394 //! on the span Knots(Index) - Knots(Index+1)
0e14656b 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);
42cf5bc1 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
0e14656b 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);
42cf5bc1 403
0e14656b 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);
42cf5bc1 405
406 //! Copy in <LP> the poles and weights for the Eval
407 //! scheme. starting from Poles(Poles.Lower()+Index)
0e14656b 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);
42cf5bc1 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.
0e14656b 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);
42cf5bc1 441
0e14656b 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);
42cf5bc1 443
0e14656b 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);
42cf5bc1 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.
0e14656b 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);
42cf5bc1 473
0e14656b 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);
42cf5bc1 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.
0e14656b 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);
42cf5bc1 486
0e14656b 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);
42cf5bc1 488
489 //! Raise the multiplicity of knot to <UMult>.
490 //!
491 //! The new control points are returned. Knots and Mults are
492 //! not updated.
0e14656b 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);
42cf5bc1 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
0e14656b 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);
42cf5bc1 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.
0e14656b 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);
42cf5bc1 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
0e14656b 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);
42cf5bc1 528
0e14656b 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);
42cf5bc1 530
0e14656b 531 Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& NewPoles, TColStd_Array1OfReal* NewWeights);
42cf5bc1 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.
0e14656b 590 Standard_EXPORT static void IncreaseDegree (const Standard_Integer NewDegree, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& NewPoles, TColStd_Array1OfReal* NewWeights);
42cf5bc1 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
0e14656b 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);
42cf5bc1 601
0e14656b 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);
42cf5bc1 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
0e14656b 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);
42cf5bc1 612
0e14656b 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);
42cf5bc1 614
0e14656b 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);
42cf5bc1 616
0e14656b 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);
42cf5bc1 618
0e14656b 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);
42cf5bc1 620
0e14656b 621 Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P);
42cf5bc1 622
0e14656b 623 Standard_EXPORT static void D0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P);
42cf5bc1 624
0e14656b 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);
42cf5bc1 626
0e14656b 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);
42cf5bc1 628
0e14656b 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);
42cf5bc1 630
0e14656b 631 Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& P, gp_Vec& V);
42cf5bc1 632
0e14656b 633 Standard_EXPORT static void D1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& P, gp_Vec2d& V);
42cf5bc1 634
0e14656b 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);
42cf5bc1 636
0e14656b 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);
42cf5bc1 638
0e14656b 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);
42cf5bc1 640
0e14656b 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);
42cf5bc1 642
0e14656b 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);
42cf5bc1 644
0e14656b 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);
42cf5bc1 646
0e14656b 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);
42cf5bc1 648
0e14656b 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);
42cf5bc1 650
0e14656b 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);
42cf5bc1 652
0e14656b 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);
42cf5bc1 654
0e14656b 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);
42cf5bc1 656
0e14656b 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);
42cf5bc1 658
0e14656b 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);
42cf5bc1 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
6143f12f 705 Standard_EXPORT static Standard_Integer EvalBsplineBasis (const Standard_Integer DerivativeOrder,
706 const Standard_Integer Order,
707 const TColStd_Array1OfReal& FlatKnots,
708 const Standard_Real Parameter,
709 Standard_Integer& FirstNonZeroBsplineIndex,
710 math_Matrix& BsplineBasis,
711 const Standard_Boolean isPeriodic = Standard_False);
42cf5bc1 712
713 //! This Builds a fully blown Matrix of
714 //! (ni)
715 //! Bi (tj)
716 //!
717 //! with i and j within 1..Order + NumPoles
718 //! The integer ni is the ith slot of the
719 //! array OrderArray, tj is the jth slot of
720 //! the array Parameters
721 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);
722
723 //! this factors the Banded Matrix in
724 //! the LU form with a Banded storage of
725 //! components of the L matrix
726 //! WARNING : do not use if the Matrix is
727 //! totally positive (It is the case for
728 //! Bspline matrices build as above with
729 //! parameters being the Schoenberg points
730 Standard_EXPORT static Standard_Integer FactorBandedMatrix (math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, Standard_Integer& PivotIndexProblem);
731
732 //! This solves the system Matrix.X = B
733 //! with when Matrix is factored in LU form
734 //! The Array is an seen as an
735 //! Array[1..N][1..ArrayDimension] with N =
736 //! the rank of the matrix Matrix. The
737 //! result is stored in Array when each
738 //! coordinate is solved that is B is the
739 //! array whose values are
740 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
741 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);
742
743 //! This solves the system Matrix.X = B
744 //! with when Matrix is factored in LU form
745 //! The Array has the length of
746 //! the rank of the matrix Matrix. The
747 //! result is stored in Array when each
748 //! coordinate is solved that is B is the
749 //! array whose values are
750 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
751 Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt2d& Array);
752
753 //! This solves the system Matrix.X = B
754 //! with when Matrix is factored in LU form
755 //! The Array has the length of
756 //! the rank of the matrix Matrix. The
757 //! result is stored in Array when each
758 //! coordinate is solved that is B is the
759 //! array whose values are
760 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
761 Standard_EXPORT static Standard_Integer SolveBandedSystem (const math_Matrix& Matrix, const Standard_Integer UpperBandWidth, const Standard_Integer LowerBandWidth, TColgp_Array1OfPnt& Array);
762
763 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);
764
765 //! This solves the system Matrix.X = B
766 //! with when Matrix is factored in LU form
767 //! The Array is an seen as an
768 //! Array[1..N][1..ArrayDimension] with N =
769 //! the rank of the matrix Matrix. The
770 //! result is stored in Array when each
771 //! coordinate is solved that is B is the
772 //! array whose values are B[i] =
773 //! Array[i][p] for each p in
774 //! 1..ArrayDimension. If HomogeneousFlag ==
775 //! 0 the Poles are multiplied by the
776 //! Weights uppon Entry and once
777 //! interpolation is carried over the
778 //! result of the poles are divided by the
779 //! result of the interpolation of the
780 //! weights. Otherwise if HomogenousFlag == 1
781 //! the Poles and Weigths are treated homogenously
782 //! that is that those are interpolated as they
783 //! are and result is returned without division
784 //! by the interpolated weigths.
785 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);
786
787 //! This solves the system Matrix.X = B
788 //! with when Matrix is factored in LU form
789 //! The Array is an seen as an
790 //! Array[1..N][1..ArrayDimension] with N =
791 //! the rank of the matrix Matrix. The
792 //! result is stored in Array when each
793 //! coordinate is solved that is B is the
794 //! array whose values are
795 //! B[i] = Array[i][p] for each p in 1..ArrayDimension
796 //! If HomogeneousFlag ==
797 //! 0 the Poles are multiplied by the
798 //! Weights uppon Entry and once
799 //! interpolation is carried over the
800 //! result of the poles are divided by the
801 //! result of the interpolation of the
802 //! weights. Otherwise if HomogenousFlag == 1
803 //! the Poles and Weigths are treated homogenously
804 //! that is that those are interpolated as they
805 //! are and result is returned without division
806 //! by the interpolated weigths.
807 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);
808
809 //! Merges two knot vector by setting the starting and
810 //! ending values to StartValue and EndValue
811 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);
812
813 //! This function will compose a given Vectorial BSpline F(t)
814 //! defined by its BSplineDegree and BSplineFlatKnotsl,
815 //! its Poles array which are coded as an array of Real
816 //! of the form [1..NumPoles][1..PolesDimension] with a
817 //! function a(t) which is assumed to satisfy the
818 //! following:
819 //!
820 //! 1. F(a(t)) is a polynomial BSpline
821 //! that can be expressed exactly as a BSpline of degree
822 //! NewDegree on the knots FlatKnots
823 //!
824 //! 2. a(t) defines a differentiable
825 //! isomorphism between the range of FlatKnots to the range
826 //! of BSplineFlatKnots which is the
827 //! same as the range of F(t)
828 //!
829 //! Warning: it is
830 //! the caller's responsability to insure that conditions
831 //! 1. and 2. above are satisfied : no check whatsoever
832 //! is made in this method
833 //!
834 //! Status will return 0 if OK else it will return the pivot index
835 //! of the matrix that was inverted to compute the multiplied
836 //! BSpline : the method used is interpolation at Schoenenberg
837 //! points of F(a(t))
838 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);
839
840 //! This function will compose a given Vectorial BSpline F(t)
841 //! defined by its BSplineDegree and BSplineFlatKnotsl,
842 //! its Poles array which are coded as an array of Real
843 //! of the form [1..NumPoles][1..PolesDimension] with a
844 //! function a(t) which is assumed to satisfy the
845 //! following:
846 //!
847 //! 1. F(a(t)) is a polynomial BSpline
848 //! that can be expressed exactly as a BSpline of degree
849 //! NewDegree on the knots FlatKnots
850 //!
851 //! 2. a(t) defines a differentiable
852 //! isomorphism between the range of FlatKnots to the range
853 //! of BSplineFlatKnots which is the
854 //! same as the range of F(t)
855 //!
856 //! Warning: it is
857 //! the caller's responsability to insure that conditions
858 //! 1. and 2. above are satisfied : no check whatsoever
859 //! is made in this method
860 //!
861 //! Status will return 0 if OK else it will return the pivot index
862 //! of the matrix that was inverted to compute the multiplied
863 //! BSpline : the method used is interpolation at Schoenenberg
864 //! points of F(a(t))
865 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);
866
867 //! this will compose a given Vectorial BSpline F(t)
868 //! defined by its BSplineDegree and BSplineFlatKnotsl,
869 //! its Poles array which are coded as an array of Real
870 //! of the form [1..NumPoles][1..PolesDimension] with a
871 //! function a(t) which is assumed to satisfy the
872 //! following : 1. F(a(t)) is a polynomial BSpline
873 //! that can be expressed exactly as a BSpline of degree
874 //! NewDegree on the knots FlatKnots
875 //! 2. a(t) defines a differentiable
876 //! isomorphism between the range of FlatKnots to the range
877 //! of BSplineFlatKnots which is the
878 //! same as the range of F(t)
879 //! Warning: it is
880 //! the caller's responsability to insure that conditions
881 //! 1. and 2. above are satisfied : no check whatsoever
882 //! is made in this method
883 //! Status will return 0 if OK else it will return the pivot index
884 //! of the matrix that was inverted to compute the multiplied
885 //! BSpline : the method used is interpolation at Schoenenberg
886 //! points of F(a(t))
887 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);
888
889 //! this will compose a given Vectorial BSpline F(t)
890 //! defined by its BSplineDegree and BSplineFlatKnotsl,
891 //! its Poles array which are coded as an array of Real
892 //! of the form [1..NumPoles][1..PolesDimension] with a
893 //! function a(t) which is assumed to satisfy the
894 //! following : 1. F(a(t)) is a polynomial BSpline
895 //! that can be expressed exactly as a BSpline of degree
896 //! NewDegree on the knots FlatKnots
897 //! 2. a(t) defines a differentiable
898 //! isomorphism between the range of FlatKnots to the range
899 //! of BSplineFlatKnots which is the
900 //! same as the range of F(t)
901 //! Warning: it is
902 //! the caller's responsability to insure that conditions
903 //! 1. and 2. above are satisfied : no check whatsoever
904 //! is made in this method
905 //! Status will return 0 if OK else it will return the pivot index
906 //! of the matrix that was inverted to compute the multiplied
907 //! BSpline : the method used is interpolation at Schoenenberg
908 //! points of F(a(t))
909 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);
910
911 //! this will multiply a given Vectorial BSpline F(t)
912 //! defined by its BSplineDegree and BSplineFlatKnotsl,
913 //! its Poles array which are coded as an array of Real
914 //! of the form [1..NumPoles][1..PolesDimension] by a
915 //! function a(t) which is assumed to satisfy the
916 //! following : 1. a(t) * F(t) is a polynomial BSpline
917 //! that can be expressed exactly as a BSpline of degree
918 //! NewDegree on the knots FlatKnots 2. the range of a(t)
919 //! is the same as the range of F(t)
920 //! Warning: it is
921 //! the caller's responsability to insure that conditions
922 //! 1. and 2. above are satisfied : no check whatsoever
923 //! is made in this method
924 //! Status will return 0 if OK else it will return the pivot index
925 //! of the matrix that was inverted to compute the multiplied
926 //! BSpline : the method used is interpolation at Schoenenberg
927 //! points of a(t)*F(t)
928 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);
929
930 //! this will multiply a given Vectorial BSpline F(t)
931 //! defined by its BSplineDegree and BSplineFlatKnotsl,
932 //! its Poles array which are coded as an array of Real
933 //! of the form [1..NumPoles][1..PolesDimension] by a
934 //! function a(t) which is assumed to satisfy the
935 //! following : 1. a(t) * F(t) is a polynomial BSpline
936 //! that can be expressed exactly as a BSpline of degree
937 //! NewDegree on the knots FlatKnots 2. the range of a(t)
938 //! is the same as the range of F(t)
939 //! Warning: it is
940 //! the caller's responsability to insure that conditions
941 //! 1. and 2. above are satisfied : no check whatsoever
942 //! is made in this method
943 //! Status will return 0 if OK else it will return the pivot index
944 //! of the matrix that was inverted to compute the multiplied
945 //! BSpline : the method used is interpolation at Schoenenberg
946 //! points of a(t)*F(t)
947 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);
948
949 //! this will multiply a given Vectorial BSpline F(t)
950 //! defined by its BSplineDegree and BSplineFlatKnotsl,
951 //! its Poles array which are coded as an array of Real
952 //! of the form [1..NumPoles][1..PolesDimension] by a
953 //! function a(t) which is assumed to satisfy the
954 //! following : 1. a(t) * F(t) is a polynomial BSpline
955 //! that can be expressed exactly as a BSpline of degree
956 //! NewDegree on the knots FlatKnots 2. the range of a(t)
957 //! is the same as the range of F(t)
958 //! Warning: it is
959 //! the caller's responsability to insure that conditions
960 //! 1. and 2. above are satisfied : no check whatsoever
961 //! is made in this method
962 //! Status will return 0 if OK else it will return the pivot index
963 //! of the matrix that was inverted to compute the multiplied
964 //! BSpline : the method used is interpolation at Schoenenberg
965 //! points of a(t)*F(t)
966 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);
967
968 //! this will multiply a given Vectorial BSpline F(t)
969 //! defined by its BSplineDegree and BSplineFlatKnotsl,
970 //! its Poles array which are coded as an array of Real
971 //! of the form [1..NumPoles][1..PolesDimension] by a
972 //! function a(t) which is assumed to satisfy the
973 //! following : 1. a(t) * F(t) is a polynomial BSpline
974 //! that can be expressed exactly as a BSpline of degree
975 //! NewDegree on the knots FlatKnots 2. the range of a(t)
976 //! is the same as the range of F(t)
977 //! Warning: it is
978 //! the caller's responsability to insure that conditions
979 //! 1. and 2. above are satisfied : no check whatsoever
980 //! is made in this method
981 //! Status will return 0 if OK else it will return the pivot index
982 //! of the matrix that was inverted to compute the multiplied
983 //! BSpline : the method used is interpolation at Schoenenberg
984 //! points of a(t)*F(t)
985 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);
986
987 //! Perform the De Boor algorithm to evaluate a point at
988 //! parameter <U>, with <Degree> and <Dimension>.
989 //!
990 //! Poles is an array of Reals of size
991 //!
992 //! <Dimension> * <Degree>+1
993 //!
994 //! Containing the poles. At the end <Poles> contains
995 //! the current point. Poles Contain all the poles of
996 //! the BsplineCurve, Knots also Contains all the knots
997 //! of the BsplineCurve. ExtrapMode has two slots [0] =
998 //! Degree used to extrapolate before the first knot [1]
999 //! = Degre used to extrapolate after the last knot has
1000 //! to be between 1 and Degree
1001 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);
1002
1003 //! Perform the De Boor algorithm to evaluate a point at
1004 //! parameter <U>, with <Degree> and <Dimension>.
1005 //! Evaluates by multiplying the Poles by the Weights and
1006 //! gives the homogeneous result in PolesResult that is
1007 //! the results of the evaluation of the numerator once it
1008 //! has been multiplied by the weights and in
1009 //! WeightsResult one has the result of the evaluation of
1010 //! the denominator
1011 //!
1012 //! Warning: <PolesResult> and <WeightsResult> must be dimensionned
1013 //! properly.
1014 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);
1015
1016 //! Perform the evaluation of the Bspline Basis
1017 //! and then multiplies by the weights
1018 //! this just evaluates the current point
1019 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);
1020
1021 //! Perform the evaluation of the Bspline Basis
1022 //! and then multiplies by the weights
1023 //! this just evaluates the current point
1024 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);
1025
1026 //! Extend a BSpline nD using the tangency map
1027 //! <C1Coefficient> is the coefficient of reparametrisation
1028 //! <Continuity> must be equal to 1, 2 or 3.
1029 //! <Degree> must be greater or equal than <Continuity> + 1.
1030 //!
1031 //! Warning: <KnotsResult> and <PolesResult> must be dimensionned
1032 //! properly.
1033 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);
1034
1035 //! Perform the evaluation of the of the cache
1036 //! the parameter must be normalized between
1037 //! the 0 and 1 for the span.
1038 //! The Cache must be valid when calling this
1039 //! routine. Geom Package will insure that.
1040 //! and then multiplies by the weights
1041 //! this just evaluates the current point
1042 //! the CacheParameter is where the Cache was
1043 //! constructed the SpanLength is to normalize
1044 //! the polynomial in the cache to avoid bad conditioning
1045 //! effects
0e14656b 1046 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);
42cf5bc1 1047
1048 //! Perform the evaluation of the Bspline Basis
1049 //! and then multiplies by the weights
1050 //! this just evaluates the current point
1051 //! the parameter must be normalized between
1052 //! the 0 and 1 for the span.
1053 //! The Cache must be valid when calling this
1054 //! routine. Geom Package will insure that.
1055 //! and then multiplies by the weights
1056 //! ththe CacheParameter is where the Cache was
1057 //! constructed the SpanLength is to normalize
1058 //! the polynomial in the cache to avoid bad conditioning
1059 //! effectsis just evaluates the current point
0e14656b 1060 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);
42cf5bc1 1061
1062 //! Calls CacheD0 for Bezier Curves Arrays computed with
1063 //! the method PolesCoefficients.
1064 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1065 static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point);
42cf5bc1 1066
1067 //! Calls CacheD0 for Bezier Curves Arrays computed with
1068 //! the method PolesCoefficients.
1069 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1070 static void CoefsD0 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point);
42cf5bc1 1071
1072 //! Perform the evaluation of the of the cache
1073 //! the parameter must be normalized between
1074 //! the 0 and 1 for the span.
1075 //! The Cache must be valid when calling this
1076 //! routine. Geom Package will insure that.
1077 //! and then multiplies by the weights
1078 //! this just evaluates the current point
1079 //! the CacheParameter is where the Cache was
1080 //! constructed the SpanLength is to normalize
1081 //! the polynomial in the cache to avoid bad conditioning
1082 //! effects
0e14656b 1083 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);
42cf5bc1 1084
1085 //! Perform the evaluation of the Bspline Basis
1086 //! and then multiplies by the weights
1087 //! this just evaluates the current point
1088 //! the parameter must be normalized between
1089 //! the 0 and 1 for the span.
1090 //! The Cache must be valid when calling this
1091 //! routine. Geom Package will insure that.
1092 //! and then multiplies by the weights
1093 //! ththe CacheParameter is where the Cache was
1094 //! constructed the SpanLength is to normalize
1095 //! the polynomial in the cache to avoid bad conditioning
1096 //! effectsis just evaluates the current point
0e14656b 1097 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);
42cf5bc1 1098
1099 //! Calls CacheD1 for Bezier Curves Arrays computed with
1100 //! the method PolesCoefficients.
1101 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1102 static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec);
42cf5bc1 1103
1104 //! Calls CacheD1 for Bezier Curves Arrays computed with
1105 //! the method PolesCoefficients.
1106 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1107 static void CoefsD1 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec);
42cf5bc1 1108
1109 //! Perform the evaluation of the of the cache
1110 //! the parameter must be normalized between
1111 //! the 0 and 1 for the span.
1112 //! The Cache must be valid when calling this
1113 //! routine. Geom Package will insure that.
1114 //! and then multiplies by the weights
1115 //! this just evaluates the current point
1116 //! the CacheParameter is where the Cache was
1117 //! constructed the SpanLength is to normalize
1118 //! the polynomial in the cache to avoid bad conditioning
1119 //! effects
0e14656b 1120 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);
42cf5bc1 1121
1122 //! Perform the evaluation of the Bspline Basis
1123 //! and then multiplies by the weights
1124 //! this just evaluates the current point
1125 //! the parameter must be normalized between
1126 //! the 0 and 1 for the span.
1127 //! The Cache must be valid when calling this
1128 //! routine. Geom Package will insure that.
1129 //! and then multiplies by the weights
1130 //! ththe CacheParameter is where the Cache was
1131 //! constructed the SpanLength is to normalize
1132 //! the polynomial in the cache to avoid bad conditioning
1133 //! effectsis just evaluates the current point
0e14656b 1134 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);
42cf5bc1 1135
1136 //! Calls CacheD1 for Bezier Curves Arrays computed with
1137 //! the method PolesCoefficients.
1138 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1139 static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt& Point, gp_Vec& Vec1, gp_Vec& Vec2);
42cf5bc1 1140
1141 //! Calls CacheD1 for Bezier Curves Arrays computed with
1142 //! the method PolesCoefficients.
1143 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1144 static void CoefsD2 (const Standard_Real U, const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, gp_Pnt2d& Point, gp_Vec2d& Vec1, gp_Vec2d& Vec2);
42cf5bc1 1145
1146 //! Perform the evaluation of the of the cache
1147 //! the parameter must be normalized between
1148 //! the 0 and 1 for the span.
1149 //! The Cache must be valid when calling this
1150 //! routine. Geom Package will insure that.
1151 //! and then multiplies by the weights
1152 //! this just evaluates the current point
1153 //! the CacheParameter is where the Cache was
1154 //! constructed the SpanLength is to normalize
1155 //! the polynomial in the cache to avoid bad conditioning
1156 //! effects
0e14656b 1157 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);
42cf5bc1 1158
1159 //! Perform the evaluation of the Bspline Basis
1160 //! and then multiplies by the weights
1161 //! this just evaluates the current point
1162 //! the parameter must be normalized between
1163 //! the 0 and 1 for the span.
1164 //! The Cache must be valid when calling this
1165 //! routine. Geom Package will insure that.
1166 //! and then multiplies by the weights
1167 //! ththe CacheParameter is where the Cache was
1168 //! constructed the SpanLength is to normalize
1169 //! the polynomial in the cache to avoid bad conditioning
1170 //! effectsis just evaluates the current point
0e14656b 1171 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);
42cf5bc1 1172
1173 //! Calls CacheD1 for Bezier Curves Arrays computed with
1174 //! the method PolesCoefficients.
1175 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1176 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);
42cf5bc1 1177
1178 //! Calls CacheD1 for Bezier Curves Arrays computed with
1179 //! the method PolesCoefficients.
1180 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1181 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);
42cf5bc1 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
0e14656b 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_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
42cf5bc1 1188
1189 //! Perform the evaluation of the Taylor expansion
1190 //! of the Bspline normalized between 0 and 1.
1191 //! If rational computes the homogeneous Taylor expension
1192 //! for the numerator and stores it in CachePoles
0e14656b 1193 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);
42cf5bc1 1194
1195 //! Perform the evaluation of the Taylor expansion
1196 //! of the Bspline normalized between 0 and 1.
1197 //! Structure of result optimized for BSplCLib_Cache.
a061150b 1198 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);
42cf5bc1 1199
1200 //! Perform the evaluation of the Taylor expansion
1201 //! of the Bspline normalized between 0 and 1.
1202 //! Structure of result optimized for BSplCLib_Cache.
a061150b 1203 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);
42cf5bc1 1204
1205 static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
1206
0e14656b 1207 Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt2d& CachePoles, TColStd_Array1OfReal* CacheWeights);
42cf5bc1 1208
1209 static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, TColgp_Array1OfPnt& CachePoles);
1210
1211 //! Encapsulation of BuildCache to perform the
1212 //! evaluation of the Taylor expansion for beziercurves
1213 //! at parameter 0.
1214 //! Warning: To be used for Beziercurves ONLY!!!
0e14656b 1215 Standard_EXPORT static void PolesCoefficients (const TColgp_Array1OfPnt& Poles, const TColStd_Array1OfReal* Weights, TColgp_Array1OfPnt& CachePoles, TColStd_Array1OfReal* CacheWeights);
42cf5bc1 1216
1217 //! Returns pointer to statically allocated array representing
1218 //! flat knots for bezier curve of the specified degree.
1219 //! Raises OutOfRange if Degree > MaxDegree()
1220 Standard_EXPORT static const Standard_Real& FlatBezierKnots (const Standard_Integer Degree);
1221
1222 //! builds the Schoenberg points from the flat knot
1223 //! used to interpolate a BSpline since the
1224 //! BSpline matrix is invertible.
1225 Standard_EXPORT static void BuildSchoenbergPoints (const Standard_Integer Degree, const TColStd_Array1OfReal& FlatKnots, TColStd_Array1OfReal& Parameters);
1226
1227 //! Performs the interpolation of the data given in
1228 //! the Poles array according to the requests in
1229 //! ContactOrderArray that is : if
1230 //! ContactOrderArray(i) has value d it means that
1231 //! Poles(i) containes the dth derivative of the
1232 //! function to be interpolated. The length L of the
1233 //! following arrays must be the same :
1234 //! Parameters, ContactOrderArray, Poles,
1235 //! The length of FlatKnots is Degree + L + 1
1236 //! Warning:
1237 //! the method used to do that interpolation is
1238 //! gauss elimination WITHOUT pivoting. Thus if the
1239 //! diagonal is not dominant there is no guarantee
1240 //! that the algorithm will work. Nevertheless for
1241 //! Cubic interpolation or interpolation at Scheonberg
1242 //! points the method will work
1243 //! The InversionProblem will report 0 if there was no
1244 //! problem else it will give the index of the faulty
1245 //! pivot
1246 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);
1247
1248 //! Performs the interpolation of the data given in
1249 //! the Poles array according to the requests in
1250 //! ContactOrderArray that is : if
1251 //! ContactOrderArray(i) has value d it means that
1252 //! Poles(i) containes the dth derivative of the
1253 //! function to be interpolated. The length L of the
1254 //! following arrays must be the same :
1255 //! Parameters, ContactOrderArray, Poles,
1256 //! The length of FlatKnots is Degree + L + 1
1257 //! Warning:
1258 //! the method used to do that interpolation is
1259 //! gauss elimination WITHOUT pivoting. Thus if the
1260 //! diagonal is not dominant there is no guarantee
1261 //! that the algorithm will work. Nevertheless for
1262 //! Cubic interpolation at knots or interpolation at Scheonberg
1263 //! points the method will work.
1264 //! The InversionProblem w
1265 //! ll report 0 if there was no
1266 //! problem else it will give the index of the faulty
1267 //! pivot
1268 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);
1269
1270 //! Performs the interpolation of the data given in
1271 //! the Poles array according to the requests in
1272 //! ContactOrderArray that is : if
1273 //! ContactOrderArray(i) has value d it means that
1274 //! Poles(i) containes the dth derivative of the
1275 //! function to be interpolated. The length L of the
1276 //! following arrays must be the same :
1277 //! Parameters, ContactOrderArray, Poles,
1278 //! The length of FlatKnots is Degree + L + 1
1279 //! Warning:
1280 //! the method used to do that interpolation is
1281 //! gauss elimination WITHOUT pivoting. Thus if the
1282 //! diagonal is not dominant there is no guarantee
1283 //! that the algorithm will work. Nevertheless for
1284 //! Cubic interpolation at knots or interpolation at Scheonberg
1285 //! points the method will work.
1286 //! The InversionProblem will report 0 if there was no
1287 //! problem else it will give the index of the faulty
1288 //! pivot
1289 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);
1290
1291 //! Performs the interpolation of the data given in
1292 //! the Poles array according to the requests in
1293 //! ContactOrderArray that is : if
1294 //! ContactOrderArray(i) has value d it means that
1295 //! Poles(i) containes the dth derivative of the
1296 //! function to be interpolated. The length L of the
1297 //! following arrays must be the same :
1298 //! Parameters, ContactOrderArray, Poles,
1299 //! The length of FlatKnots is Degree + L + 1
1300 //! Warning:
1301 //! the method used to do that interpolation is
1302 //! gauss elimination WITHOUT pivoting. Thus if the
1303 //! diagonal is not dominant there is no guarantee
1304 //! that the algorithm will work. Nevertheless for
1305 //! Cubic interpolation at knots or interpolation at Scheonberg
1306 //! points the method will work.
1307 //! The InversionProblem w
1308 //! ll report 0 if there was no
1309 //! problem else it will give the i
1310 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);
1311
1312 //! Performs the interpolation of the data given in
1313 //! the Poles array according to the requests in
1314 //! ContactOrderArray that is : if
1315 //! ContactOrderArray(i) has value d it means that
1316 //! Poles(i) containes the dth derivative of the
1317 //! function to be interpolated. The length L of the
1318 //! following arrays must be the same :
1319 //! Parameters, ContactOrderArray
1320 //! The length of FlatKnots is Degree + L + 1
1321 //! The PolesArray is an seen as an
1322 //! Array[1..N][1..ArrayDimension] with N = tge length
1323 //! of the parameters array
1324 //! Warning:
1325 //! the method used to do that interpolation is
1326 //! gauss elimination WITHOUT pivoting. Thus if the
1327 //! diagonal is not dominant there is no guarantee
1328 //! that the algorithm will work. Nevertheless for
1329 //! Cubic interpolation or interpolation at Scheonberg
1330 //! points the method will work
1331 //! The InversionProblem will report 0 if there was no
1332 //! problem else it will give the index of the faulty
1333 //! pivot
1334 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);
1335
1336 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);
1337
1338 //! Find the new poles which allows an old point (with a
1339 //! given u as parameter) to reach a new position
1340 //! Index1 and Index2 indicate the range of poles we can move
1341 //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1342 //! don't enter (1,NbPoles) -> error: rigid move
1343 //! (2, NbPoles-1) -> the ends are enforced
1344 //! (3, NbPoles-2) -> the ends and the tangency are enforced
1345 //! if Problem in BSplineBasis calculation, no change for the curve
1346 //! and FirstIndex, LastIndex = 0
1347 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);
1348
1349 //! Find the new poles which allows an old point (with a
1350 //! given u as parameter) to reach a new position
1351 //! Index1 and Index2 indicate the range of poles we can move
1352 //! (1, NbPoles-1) or (2, NbPoles) -> no constraint for one side
1353 //! don't enter (1,NbPoles) -> error: rigid move
1354 //! (2, NbPoles-1) -> the ends are enforced
1355 //! (3, NbPoles-2) -> the ends and the tangency are enforced
1356 //! if Problem in BSplineBasis calculation, no change for the curve
1357 //! and FirstIndex, LastIndex = 0
1358 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);
1359
1360 //! This is the dimension free version of the utility
1361 //! U is the parameter must be within the first FlatKnots and the
1362 //! last FlatKnots Delta is the amount the curve has to be moved
1363 //! DeltaDerivative is the amount the derivative has to be moved.
1364 //! Delta and DeltaDerivative must be array of dimension
1365 //! ArrayDimension Degree is the degree of the BSpline and the
1366 //! FlatKnots are the knots of the BSpline Starting Condition if =
1367 //! -1 means the starting point of the curve can move
1368 //! = 0 means the
1369 //! starting point of the cuve cannot move but tangen starting
1370 //! point of the curve cannot move
1371 //! = 1 means the starting point and tangents cannot move
1372 //! = 2 means the starting point tangent and curvature cannot move
1373 //! = ...
1374 //! Same holds for EndingCondition
1375 //! Poles are the poles of the curve
1376 //! Weights are the weights of the curve if Rational = Standard_True
1377 //! NewPoles are the poles of the deformed curve
1378 //! ErrorStatus will be 0 if no error happened
1379 //! 1 if there are not enough knots/poles
1380 //! the imposed conditions
1381 //! The way to solve this problem is to add knots to the BSpline
1382 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1383 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1384 //! have at least 2 internal knots.
1385 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);
1386
1387 //! This is the dimension free version of the utility
1388 //! U is the parameter must be within the first FlatKnots and the
1389 //! last FlatKnots Delta is the amount the curve has to be moved
1390 //! DeltaDerivative is the amount the derivative has to be moved.
1391 //! Delta and DeltaDerivative must be array of dimension
1392 //! ArrayDimension Degree is the degree of the BSpline and the
1393 //! FlatKnots are the knots of the BSpline Starting Condition if =
1394 //! -1 means the starting point of the curve can move
1395 //! = 0 means the
1396 //! starting point of the cuve cannot move but tangen starting
1397 //! point of the curve cannot move
1398 //! = 1 means the starting point and tangents cannot move
1399 //! = 2 means the starting point tangent and curvature cannot move
1400 //! = ...
1401 //! Same holds for EndingCondition
1402 //! Poles are the poles of the curve
1403 //! Weights are the weights of the curve if Rational = Standard_True
1404 //! NewPoles are the poles of the deformed curve
1405 //! ErrorStatus will be 0 if no error happened
1406 //! 1 if there are not enough knots/poles
1407 //! the imposed conditions
1408 //! The way to solve this problem is to add knots to the BSpline
1409 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1410 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1411 //! have at least 2 internal knots.
1412 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);
1413
1414 //! This is the dimension free version of the utility
1415 //! U is the parameter must be within the first FlatKnots and the
1416 //! last FlatKnots Delta is the amount the curve has to be moved
1417 //! DeltaDerivative is the amount the derivative has to be moved.
1418 //! Delta and DeltaDerivative must be array of dimension
1419 //! ArrayDimension Degree is the degree of the BSpline and the
1420 //! FlatKnots are the knots of the BSpline Starting Condition if =
1421 //! -1 means the starting point of the curve can move
1422 //! = 0 means the
1423 //! starting point of the cuve cannot move but tangen starting
1424 //! point of the curve cannot move
1425 //! = 1 means the starting point and tangents cannot move
1426 //! = 2 means the starting point tangent and curvature cannot move
1427 //! = ...
1428 //! Same holds for EndingCondition
1429 //! Poles are the poles of the curve
1430 //! Weights are the weights of the curve if Rational = Standard_True
1431 //! NewPoles are the poles of the deformed curve
1432 //! ErrorStatus will be 0 if no error happened
1433 //! 1 if there are not enough knots/poles
1434 //! the imposed conditions
1435 //! The way to solve this problem is to add knots to the BSpline
1436 //! If StartCondition = 1 and EndCondition = 1 then you need at least
1437 //! 4 + 2 = 6 poles so for example to have a C1 cubic you will need
1438 //! have at least 2 internal knots.
1439 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);
1440
1441
1442 //! given a tolerance in 3D space returns a
1443 //! tolerance in U parameter space such that
1444 //! all u1 and u0 in the domain of the curve f(u)
1445 //! | u1 - u0 | < UTolerance and
1446 //! we have |f (u1) - f (u0)| < Tolerance3D
0e14656b 1447 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);
42cf5bc1 1448
1449
1450 //! given a tolerance in 3D space returns a
1451 //! tolerance in U parameter space such that
1452 //! all u1 and u0 in the domain of the curve f(u)
1453 //! | u1 - u0 | < UTolerance and
1454 //! we have |f (u1) - f (u0)| < Tolerance3D
0e14656b 1455 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);
42cf5bc1 1456
1457
1458 //! given a tolerance in 3D space returns a
1459 //! tolerance in U parameter space such that
1460 //! all u1 and u0 in the domain of the curve f(u)
1461 //! | u1 - u0 | < UTolerance and
1462 //! we have |f (u1) - f (u0)| < Tolerance3D
0e14656b 1463 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);
42cf5bc1 1464
1465
1466
1467
1468protected:
1469
1470
1471
1472
1473
1474private:
1475
1476
1477 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
1479
1480
1481
1482};
1483
1484
1485#include <BSplCLib.lxx>
1486
1487
1488
1489
1490
1491#endif // _BSplCLib_HeaderFile