42cf5bc1 |
1 | // Created on: 1995-10-20 |
2 | // Created by: Laurent BOURESCHE |
3 | // Copyright (c) 1995-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 _Law_BSpline_HeaderFile |
18 | #define _Law_BSpline_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Boolean.hxx> |
24 | #include <GeomAbs_BSplKnotDistribution.hxx> |
25 | #include <GeomAbs_Shape.hxx> |
26 | #include <Standard_Integer.hxx> |
27 | #include <TColStd_HArray1OfReal.hxx> |
28 | #include <TColStd_HArray1OfInteger.hxx> |
25e59720 |
29 | #include <Standard_Transient.hxx> |
42cf5bc1 |
30 | #include <TColStd_Array1OfReal.hxx> |
31 | #include <TColStd_Array1OfInteger.hxx> |
32 | #include <Standard_Real.hxx> |
33 | class Standard_ConstructionError; |
34 | class Standard_DimensionError; |
35 | class Standard_DomainError; |
36 | class Standard_OutOfRange; |
37 | class Standard_RangeError; |
38 | class Standard_NoSuchObject; |
39 | |
40 | |
41 | class Law_BSpline; |
25e59720 |
42 | DEFINE_STANDARD_HANDLE(Law_BSpline, Standard_Transient) |
42cf5bc1 |
43 | |
44 | //! Definition of the 1D B_spline curve. |
45 | //! |
46 | //! Uniform or non-uniform |
47 | //! Rational or non-rational |
48 | //! Periodic or non-periodic |
49 | //! |
50 | //! a b-spline curve is defined by : |
51 | //! |
52 | //! The Degree (up to 25) |
53 | //! |
54 | //! The Poles (and the weights if it is rational) |
55 | //! |
56 | //! The Knots and Multiplicities |
57 | //! |
58 | //! The knot vector is an increasing sequence of |
59 | //! reals without repetition. The multiplicities are |
60 | //! the repetition of the knots. |
61 | //! |
62 | //! If the knots are regularly spaced (the difference |
63 | //! of two consecutive knots is a constant), the |
64 | //! knots repartition is : |
65 | //! |
66 | //! - Uniform if all multiplicities are 1. |
67 | //! |
68 | //! - Quasi-uniform if all multiplicities are 1 |
69 | //! but the first and the last which are Degree+1. |
70 | //! |
71 | //! - PiecewiseBezier if all multiplicites are |
72 | //! Degree but the first and the last which are |
73 | //! Degree+1. |
74 | //! |
75 | //! The curve may be periodic. |
76 | //! |
77 | //! On a periodic curve if there are k knots and p |
78 | //! poles. the period is knot(k) - knot(1) |
79 | //! |
80 | //! the poles and knots are infinite vectors with : |
81 | //! |
82 | //! knot(i+k) = knot(i) + period |
83 | //! |
84 | //! pole(i+p) = pole(i) |
85 | //! |
86 | //! References : |
87 | //! . A survey of curve and surface methods in CADG Wolfgang BOHM |
88 | //! CAGD 1 (1984) |
89 | //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM |
90 | //! cagd 5 (1988) |
91 | //! . Blossoming and knot insertion algorithms for B-spline curves |
92 | //! Ronald N. GOLDMAN |
93 | //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA |
94 | //! . Curves and Surfaces for Computer Aided Geometric Design, |
95 | //! a practical guide Gerald Farin |
25e59720 |
96 | class Law_BSpline : public Standard_Transient |
42cf5bc1 |
97 | { |
98 | |
99 | public: |
100 | |
101 | |
102 | //! Creates a non-rational B_spline curve on the |
103 | //! basis <Knots, Multiplicities> of degree <Degree>. |
104 | Standard_EXPORT Law_BSpline(const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Multiplicities, const Standard_Integer Degree, const Standard_Boolean Periodic = Standard_False); |
105 | |
106 | //! Creates a rational B_spline curve on the basis |
107 | //! <Knots, Multiplicities> of degree <Degree>. |
108 | Standard_EXPORT Law_BSpline(const TColStd_Array1OfReal& Poles, const TColStd_Array1OfReal& Weights, const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Multiplicities, const Standard_Integer Degree, const Standard_Boolean Periodic = Standard_False); |
109 | |
110 | //! Increase the degree to <Degree>. Nothing is done |
111 | //! if <Degree> is lower or equal to the current |
112 | //! degree. |
113 | Standard_EXPORT void IncreaseDegree (const Standard_Integer Degree); |
114 | |
115 | //! Increases the multiplicity of the knot <Index> to |
116 | //! <M>. |
117 | //! |
118 | //! If <M> is lower or equal to the current |
119 | //! multiplicity nothing is done. If <M> is higher than |
120 | //! the degree the degree is used. |
121 | //! If <Index> is not in [FirstUKnotIndex, LastUKnotIndex] |
122 | Standard_EXPORT void IncreaseMultiplicity (const Standard_Integer Index, const Standard_Integer M); |
123 | |
124 | //! Increases the multiplicities of the knots in |
125 | //! [I1,I2] to <M>. |
126 | //! |
127 | //! For each knot if <M> is lower or equal to the |
128 | //! current multiplicity nothing is done. If <M> is |
129 | //! higher than the degree the degree is used. |
130 | //! If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex] |
131 | Standard_EXPORT void IncreaseMultiplicity (const Standard_Integer I1, const Standard_Integer I2, const Standard_Integer M); |
132 | |
133 | //! Increment the multiplicities of the knots in |
134 | //! [I1,I2] by <M>. |
135 | //! |
136 | //! If <M> is not positive nithing is done. |
137 | //! |
138 | //! For each knot the resulting multiplicity is |
139 | //! limited to the Degree. |
140 | //! If <I1,I2> are not in [FirstUKnotIndex, LastUKnotIndex] |
141 | Standard_EXPORT void IncrementMultiplicity (const Standard_Integer I1, const Standard_Integer I2, const Standard_Integer M); |
142 | |
143 | //! Inserts a knot value in the sequence of knots. If |
144 | //! <U> is an existing knot the multiplicity is |
145 | //! increased by <M>. |
146 | //! |
147 | //! If U is not on the parameter range nothing is |
148 | //! done. |
149 | //! |
150 | //! If the multiplicity is negative or null nothing is |
151 | //! done. The new multiplicity is limited to the |
152 | //! degree. |
153 | //! |
154 | //! The tolerance criterion for knots equality is |
155 | //! the max of Epsilon(U) and ParametricTolerance. |
156 | Standard_EXPORT void InsertKnot (const Standard_Real U, const Standard_Integer M = 1, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True); |
157 | |
158 | //! Inserts a set of knots values in the sequence of |
159 | //! knots. |
160 | //! |
161 | //! For each U = Knots(i), M = Mults(i) |
162 | //! |
163 | //! If <U> is an existing knot the multiplicity is |
164 | //! increased by <M> if <Add> is True, increased to |
165 | //! <M> if <Add> is False. |
166 | //! |
167 | //! If U is not on the parameter range nothing is |
168 | //! done. |
169 | //! |
170 | //! If the multiplicity is negative or null nothing is |
171 | //! done. The new multiplicity is limited to the |
172 | //! degree. |
173 | //! |
174 | //! The tolerance criterion for knots equality is |
175 | //! the max of Epsilon(U) and ParametricTolerance. |
176 | Standard_EXPORT void InsertKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_False); |
177 | |
178 | //! Decrement the knots multiplicity to <M>. If M is |
179 | //! 0 the knot is removed. The Poles sequence is |
180 | //! modified. |
181 | //! |
182 | //! As there are two ways to compute the new poles the |
183 | //! average is computed if the distance is lower than |
184 | //! the <Tolerance>, else False is returned. |
185 | //! |
186 | //! A low tolerance is used to prevent the modification |
187 | //! of the curve. |
188 | //! |
189 | //! A high tolerance is used to "smooth" the curve. |
190 | //! |
191 | //! Raised if Index is not in the range |
192 | //! [FirstUKnotIndex, LastUKnotIndex] |
193 | //! pole insertion and pole removing |
194 | //! this operation is limited to the Uniform or QuasiUniform |
195 | //! BSplineCurve. The knot values are modified . If the BSpline is |
196 | //! NonUniform or Piecewise Bezier an exception Construction error |
197 | //! is raised. |
198 | Standard_EXPORT Standard_Boolean RemoveKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance); |
199 | |
200 | |
201 | //! Changes the direction of parametrization of <me>. The Knot |
202 | //! sequence is modified, the FirstParameter and the |
203 | //! LastParameter are not modified. The StartPoint of the |
204 | //! initial curve becomes the EndPoint of the reversed curve |
205 | //! and the EndPoint of the initial curve becomes the StartPoint |
206 | //! of the reversed curve. |
207 | Standard_EXPORT void Reverse(); |
208 | |
209 | //! Returns the parameter on the reversed curve for |
210 | //! the point of parameter U on <me>. |
211 | //! |
212 | //! returns UFirst + ULast - U |
213 | Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const; |
214 | |
215 | |
216 | //! Segments the curve between U1 and U2. |
217 | //! The control points are modified, the first and the last point |
218 | //! are not the same. |
219 | //! Warnings : |
220 | //! Even if <me> is not closed it can become closed after the |
221 | //! segmentation for example if U1 or U2 are out of the bounds |
222 | //! of the curve <me> or if the curve makes loop. |
223 | //! After the segmentation the length of a curve can be null. |
224 | //! raises if U2 < U1. |
225 | Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2); |
226 | |
227 | //! Changes the knot of range Index. |
228 | //! The multiplicity of the knot is not modified. |
229 | //! Raised if K >= Knots(Index+1) or K <= Knots(Index-1). |
230 | //! Raised if Index < 1 || Index > NbKnots |
231 | Standard_EXPORT void SetKnot (const Standard_Integer Index, const Standard_Real K); |
232 | |
233 | //! Changes all the knots of the curve |
234 | //! The multiplicity of the knots are not modified. |
235 | //! |
236 | //! Raised if there is an index such that K (Index+1) <= K (Index). |
237 | //! |
238 | //! Raised if K.Lower() < 1 or K.Upper() > NbKnots |
239 | Standard_EXPORT void SetKnots (const TColStd_Array1OfReal& K); |
240 | |
241 | |
242 | //! Changes the knot of range Index with its multiplicity. |
243 | //! You can increase the multiplicity of a knot but it is |
244 | //! not allowed to decrease the multiplicity of an existing knot. |
245 | //! |
246 | //! Raised if K >= Knots(Index+1) or K <= Knots(Index-1). |
247 | //! Raised if M is greater than Degree or lower than the previous |
248 | //! multiplicity of knot of range Index. |
249 | //! Raised if Index < 1 || Index > NbKnots |
250 | Standard_EXPORT void SetKnot (const Standard_Integer Index, const Standard_Real K, const Standard_Integer M); |
251 | |
252 | //! returns the parameter normalized within |
253 | //! the period if the curve is periodic : otherwise |
254 | //! does not do anything |
255 | Standard_EXPORT void PeriodicNormalization (Standard_Real& U) const; |
256 | |
257 | |
258 | //! Makes a closed B-spline into a periodic curve. The curve is |
259 | //! periodic if the knot sequence is periodic and if the curve is |
260 | //! closed (The tolerance criterion is Resolution from gp). |
261 | //! The period T is equal to Knot(LastUKnotIndex) - |
262 | //! Knot(FirstUKnotIndex). A periodic B-spline can be uniform |
263 | //! or not. |
264 | //! Raised if the curve is not closed. |
265 | Standard_EXPORT void SetPeriodic(); |
266 | |
267 | //! Set the origin of a periodic curve at Knot(index) |
268 | //! KnotVector and poles are modified. |
269 | //! Raised if the curve is not periodic |
270 | //! Raised if index not in the range |
271 | //! [FirstUKnotIndex , LastUKnotIndex] |
272 | Standard_EXPORT void SetOrigin (const Standard_Integer Index); |
273 | |
274 | |
275 | //! Makes a non periodic curve. If the curve was non periodic |
276 | //! the curve is not modified. |
277 | Standard_EXPORT void SetNotPeriodic(); |
278 | |
279 | //! Substitutes the Pole of range Index with P. |
280 | //! |
281 | //! Raised if Index < 1 || Index > NbPoles |
282 | Standard_EXPORT void SetPole (const Standard_Integer Index, const Standard_Real P); |
283 | |
284 | |
285 | //! Substitutes the pole and the weight of range Index. |
286 | //! If the curve <me> is not rational it can become rational |
287 | //! If the curve was rational it can become non rational |
288 | //! |
289 | //! Raised if Index < 1 || Index > NbPoles |
290 | //! Raised if Weight <= 0.0 |
291 | Standard_EXPORT void SetPole (const Standard_Integer Index, const Standard_Real P, const Standard_Real Weight); |
292 | |
293 | |
294 | //! Changes the weight for the pole of range Index. |
295 | //! If the curve was non rational it can become rational. |
296 | //! If the curve was rational it can become non rational. |
297 | //! |
298 | //! Raised if Index < 1 || Index > NbPoles |
299 | //! Raised if Weight <= 0.0 |
300 | Standard_EXPORT void SetWeight (const Standard_Integer Index, const Standard_Real Weight); |
301 | |
302 | |
303 | //! Returns the continuity of the curve, the curve is at least C0. |
304 | //! Raised if N < 0. |
305 | Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const; |
306 | |
307 | |
308 | //! Returns true if the distance between the first point and the |
309 | //! last point of the curve is lower or equal to Resolution |
310 | //! from package gp. |
311 | //! Warnings : |
312 | //! The first and the last point can be different from the first |
313 | //! pole and the last pole of the curve. |
314 | Standard_EXPORT Standard_Boolean IsClosed() const; |
315 | |
316 | //! Returns True if the curve is periodic. |
317 | Standard_EXPORT Standard_Boolean IsPeriodic() const; |
318 | |
319 | |
320 | //! Returns True if the weights are not identical. |
321 | //! The tolerance criterion is Epsilon of the class Real. |
322 | Standard_EXPORT Standard_Boolean IsRational() const; |
323 | |
324 | |
325 | //! Returns the global continuity of the curve : |
326 | //! C0 : only geometric continuity, |
327 | //! C1 : continuity of the first derivative all along the Curve, |
328 | //! C2 : continuity of the second derivative all along the Curve, |
329 | //! C3 : continuity of the third derivative all along the Curve, |
330 | //! CN : the order of continuity is infinite. |
331 | //! For a B-spline curve of degree d if a knot Ui has a |
332 | //! multiplicity p the B-spline curve is only Cd-p continuous |
333 | //! at Ui. So the global continuity of the curve can't be greater |
334 | //! than Cd-p where p is the maximum multiplicity of the interior |
335 | //! Knots. In the interior of a knot span the curve is infinitely |
336 | //! continuously differentiable. |
337 | Standard_EXPORT GeomAbs_Shape Continuity() const; |
338 | |
339 | //! Computation of value and derivatives |
340 | Standard_EXPORT Standard_Integer Degree() const; |
341 | |
342 | Standard_EXPORT Standard_Real Value (const Standard_Real U) const; |
343 | |
344 | Standard_EXPORT void D0 (const Standard_Real U, Standard_Real& P) const; |
345 | |
346 | Standard_EXPORT void D1 (const Standard_Real U, Standard_Real& P, Standard_Real& V1) const; |
347 | |
348 | Standard_EXPORT void D2 (const Standard_Real U, Standard_Real& P, Standard_Real& V1, Standard_Real& V2) const; |
349 | |
350 | Standard_EXPORT void D3 (const Standard_Real U, Standard_Real& P, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const; |
351 | |
352 | |
353 | //! The following functions computes the point of parameter U and |
354 | //! the derivatives at this point on the B-spline curve arc |
355 | //! defined between the knot FromK1 and the knot ToK2. U can be |
356 | //! out of bounds [Knot (FromK1), Knot (ToK2)] but for the |
357 | //! computation we only use the definition of the curve between |
358 | //! these two knots. This method is useful to compute local |
359 | //! derivative, if the order of continuity of the whole curve is |
360 | //! not greater enough. Inside the parametric domain Knot |
361 | //! (FromK1), Knot (ToK2) the evaluations are the same as if we |
362 | //! consider the whole definition of the curve. Of course the |
363 | //! evaluations are different outside this parametric domain. |
364 | Standard_EXPORT Standard_Real DN (const Standard_Real U, const Standard_Integer N) const; |
365 | |
366 | Standard_EXPORT Standard_Real LocalValue (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2) const; |
367 | |
368 | Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real& P) const; |
369 | |
370 | Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real& P, Standard_Real& V1) const; |
371 | |
372 | Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real& P, Standard_Real& V1, Standard_Real& V2) const; |
373 | |
374 | Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, Standard_Real& P, Standard_Real& V1, Standard_Real& V2, Standard_Real& V3) const; |
375 | |
376 | Standard_EXPORT Standard_Real LocalDN (const Standard_Real U, const Standard_Integer FromK1, const Standard_Integer ToK2, const Standard_Integer N) const; |
377 | |
378 | |
379 | //! Returns the last point of the curve. |
380 | //! Warnings : |
381 | //! The last point of the curve is different from the last |
382 | //! pole of the curve if the multiplicity of the last knot |
383 | //! is lower than Degree. |
384 | Standard_EXPORT Standard_Real EndPoint() const; |
385 | |
386 | |
387 | //! For a B-spline curve the first parameter (which gives the start |
388 | //! point of the curve) is a knot value but if the multiplicity of |
389 | //! the first knot index is lower than Degree + 1 it is not the |
390 | //! first knot of the curve. This method computes the index of the |
391 | //! knot corresponding to the first parameter. |
392 | Standard_EXPORT Standard_Integer FirstUKnotIndex() const; |
393 | |
394 | |
395 | //! Computes the parametric value of the start point of the curve. |
396 | //! It is a knot value. |
397 | Standard_EXPORT Standard_Real FirstParameter() const; |
398 | |
399 | |
400 | //! Returns the knot of range Index. When there is a knot |
401 | //! with a multiplicity greater than 1 the knot is not repeated. |
402 | //! The method Multiplicity can be used to get the multiplicity |
403 | //! of the Knot. |
404 | //! Raised if Index < 1 or Index > NbKnots |
405 | Standard_EXPORT Standard_Real Knot (const Standard_Integer Index) const; |
406 | |
407 | //! returns the knot values of the B-spline curve; |
408 | //! |
409 | //! Raised if the length of K is not equal to the number of knots. |
410 | Standard_EXPORT void Knots (TColStd_Array1OfReal& K) const; |
411 | |
412 | //! Returns the knots sequence. |
413 | //! In this sequence the knots with a multiplicity greater than 1 |
414 | //! are repeated. |
415 | //! Example : |
416 | //! K = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
417 | //! |
418 | //! Raised if the length of K is not equal to NbPoles + Degree + 1 |
419 | Standard_EXPORT void KnotSequence (TColStd_Array1OfReal& K) const; |
420 | |
421 | |
422 | //! Returns NonUniform or Uniform or QuasiUniform or PiecewiseBezier. |
423 | //! If all the knots differ by a positive constant from the |
424 | //! preceding knot the BSpline Curve can be : |
425 | //! - Uniform if all the knots are of multiplicity 1, |
426 | //! - QuasiUniform if all the knots are of multiplicity 1 except for |
427 | //! the first and last knot which are of multiplicity Degree + 1, |
428 | //! - PiecewiseBezier if the first and last knots have multiplicity |
429 | //! Degree + 1 and if interior knots have multiplicity Degree |
430 | //! A piecewise Bezier with only two knots is a BezierCurve. |
431 | //! else the curve is non uniform. |
432 | //! The tolerance criterion is Epsilon from class Real. |
433 | Standard_EXPORT GeomAbs_BSplKnotDistribution KnotDistribution() const; |
434 | |
435 | |
436 | //! For a BSpline curve the last parameter (which gives the |
437 | //! end point of the curve) is a knot value but if the |
438 | //! multiplicity of the last knot index is lower than |
439 | //! Degree + 1 it is not the last knot of the curve. This |
440 | //! method computes the index of the knot corresponding to |
441 | //! the last parameter. |
442 | Standard_EXPORT Standard_Integer LastUKnotIndex() const; |
443 | |
444 | |
445 | //! Computes the parametric value of the end point of the curve. |
446 | //! It is a knot value. |
447 | Standard_EXPORT Standard_Real LastParameter() const; |
448 | |
449 | |
450 | //! Locates the parametric value U in the sequence of knots. |
451 | //! If "WithKnotRepetition" is True we consider the knot's |
452 | //! representation with repetition of multiple knot value, |
453 | //! otherwise we consider the knot's representation with |
454 | //! no repetition of multiple knot values. |
455 | //! Knots (I1) <= U <= Knots (I2) |
456 | //! . if I1 = I2 U is a knot value (the tolerance criterion |
457 | //! ParametricTolerance is used). |
458 | //! . if I1 < 1 => U < Knots (1) - Abs(ParametricTolerance) |
459 | //! . if I2 > NbKnots => U > Knots (NbKnots) + Abs(ParametricTolerance) |
460 | Standard_EXPORT void LocateU (const Standard_Real U, const Standard_Real ParametricTolerance, Standard_Integer& I1, Standard_Integer& I2, const Standard_Boolean WithKnotRepetition = Standard_False) const; |
461 | |
462 | |
463 | //! Returns the multiplicity of the knots of range Index. |
464 | //! Raised if Index < 1 or Index > NbKnots |
465 | Standard_EXPORT Standard_Integer Multiplicity (const Standard_Integer Index) const; |
466 | |
467 | |
468 | //! Returns the multiplicity of the knots of the curve. |
469 | //! |
470 | //! Raised if the length of M is not equal to NbKnots. |
471 | Standard_EXPORT void Multiplicities (TColStd_Array1OfInteger& M) const; |
472 | |
473 | |
474 | //! Returns the number of knots. This method returns the number of |
475 | //! knot without repetition of multiple knots. |
476 | Standard_EXPORT Standard_Integer NbKnots() const; |
477 | |
478 | //! Returns the number of poles |
479 | Standard_EXPORT Standard_Integer NbPoles() const; |
480 | |
481 | //! Returns the pole of range Index. |
482 | //! Raised if Index < 1 or Index > NbPoles. |
483 | Standard_EXPORT Standard_Real Pole (const Standard_Integer Index) const; |
484 | |
485 | //! Returns the poles of the B-spline curve; |
486 | //! |
487 | //! Raised if the length of P is not equal to the number of poles. |
488 | Standard_EXPORT void Poles (TColStd_Array1OfReal& P) const; |
489 | |
490 | |
491 | //! Returns the start point of the curve. |
492 | //! Warnings : |
493 | //! This point is different from the first pole of the curve if the |
494 | //! multiplicity of the first knot is lower than Degree. |
495 | Standard_EXPORT Standard_Real StartPoint() const; |
496 | |
497 | //! Returns the weight of the pole of range Index . |
498 | //! Raised if Index < 1 or Index > NbPoles. |
499 | Standard_EXPORT Standard_Real Weight (const Standard_Integer Index) const; |
500 | |
501 | //! Returns the weights of the B-spline curve; |
502 | //! |
503 | //! Raised if the length of W is not equal to NbPoles. |
504 | Standard_EXPORT void Weights (TColStd_Array1OfReal& W) const; |
505 | |
506 | |
507 | //! Returns the value of the maximum degree of the normalized |
508 | //! B-spline basis functions in this package. |
509 | Standard_EXPORT static Standard_Integer MaxDegree(); |
510 | |
511 | |
512 | //! Changes the value of the Law at parameter U to NewValue. |
513 | //! and makes its derivative at U be derivative. |
514 | //! StartingCondition = -1 means first can move |
515 | //! EndingCondition = -1 means last point can move |
516 | //! StartingCondition = 0 means the first point cannot move |
517 | //! EndingCondition = 0 means the last point cannot move |
518 | //! StartingCondition = 1 means the first point and tangent cannot move |
519 | //! EndingCondition = 1 means the last point and tangent cannot move |
520 | //! and so forth |
521 | //! ErrorStatus != 0 means that there are not enought degree of freedom |
522 | //! with the constrain to deform the curve accordingly |
523 | Standard_EXPORT void MovePointAndTangent (const Standard_Real U, const Standard_Real NewValue, const Standard_Real Derivative, const Standard_Real Tolerance, const Standard_Integer StartingCondition, const Standard_Integer EndingCondition, Standard_Integer& ErrorStatus); |
524 | |
525 | //! given Tolerance3D returns UTolerance |
526 | //! such that if f(t) is the curve we have |
527 | //! | t1 - t0| < Utolerance ===> |
528 | //! |f(t1) - f(t0)| < Tolerance3D |
529 | Standard_EXPORT void Resolution (const Standard_Real Tolerance3D, Standard_Real& UTolerance) const; |
530 | |
531 | Standard_EXPORT Handle(Law_BSpline) Copy() const; |
532 | |
533 | |
534 | |
535 | |
25e59720 |
536 | DEFINE_STANDARD_RTTIEXT(Law_BSpline,Standard_Transient) |
42cf5bc1 |
537 | |
538 | protected: |
539 | |
540 | |
541 | |
542 | |
543 | private: |
544 | |
545 | |
546 | |
547 | //! Tells whether the Cache is valid for the |
548 | //! given parameter |
549 | //! Warnings : the parameter must be normalized within |
550 | //! the period if the curve is periodic. Otherwise |
551 | //! the answer will be false |
552 | Standard_EXPORT Standard_Boolean IsCacheValid (const Standard_Real Parameter) const; |
553 | |
554 | //! Recompute the flatknots, the knotsdistribution, the |
555 | //! continuity. |
556 | Standard_EXPORT void UpdateKnots(); |
557 | |
558 | Standard_Boolean rational; |
559 | Standard_Boolean periodic; |
560 | GeomAbs_BSplKnotDistribution knotSet; |
561 | GeomAbs_Shape smooth; |
562 | Standard_Integer deg; |
563 | Handle(TColStd_HArray1OfReal) poles; |
564 | Handle(TColStd_HArray1OfReal) weights; |
565 | Handle(TColStd_HArray1OfReal) flatknots; |
566 | Handle(TColStd_HArray1OfReal) knots; |
567 | Handle(TColStd_HArray1OfInteger) mults; |
568 | |
569 | |
570 | }; |
571 | |
572 | |
573 | |
574 | |
575 | |
576 | |
577 | |
578 | #endif // _Law_BSpline_HeaderFile |