42cf5bc1 |
1 | // Created on: 1993-03-09 |
2 | // Created by: JCV |
3 | // Copyright (c) 1993-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 _Geom_BSplineSurface_HeaderFile |
18 | #define _Geom_BSplineSurface_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 <TColgp_HArray2OfPnt.hxx> |
28 | #include <TColStd_HArray2OfReal.hxx> |
29 | #include <TColStd_HArray1OfReal.hxx> |
30 | #include <TColStd_HArray1OfInteger.hxx> |
31 | #include <Standard_Real.hxx> |
32 | #include <Geom_BoundedSurface.hxx> |
33 | #include <TColgp_Array2OfPnt.hxx> |
34 | #include <TColStd_Array1OfReal.hxx> |
35 | #include <TColStd_Array1OfInteger.hxx> |
36 | #include <TColStd_Array2OfReal.hxx> |
37 | #include <TColgp_Array1OfPnt.hxx> |
38 | class Standard_ConstructionError; |
39 | class Standard_DimensionError; |
40 | class Standard_DomainError; |
41 | class Standard_OutOfRange; |
42 | class Standard_NoSuchObject; |
43 | class Standard_RangeError; |
44 | class Geom_UndefinedDerivative; |
45 | class gp_Pnt; |
46 | class gp_Vec; |
47 | class Geom_Curve; |
48 | class gp_Trsf; |
49 | class Geom_Geometry; |
50 | |
51 | |
52 | class Geom_BSplineSurface; |
53 | DEFINE_STANDARD_HANDLE(Geom_BSplineSurface, Geom_BoundedSurface) |
54 | |
55 | //! Describes a BSpline surface. |
56 | //! In each parametric direction, a BSpline surface can be: |
57 | //! - uniform or non-uniform, |
58 | //! - rational or non-rational, |
59 | //! - periodic or non-periodic. |
60 | //! A BSpline surface is defined by: |
61 | //! - its degrees, in the u and v parametric directions, |
62 | //! - its periodic characteristic, in the u and v parametric directions, |
63 | //! - a table of poles, also called control points (together |
64 | //! with the associated weights if the surface is rational), and |
65 | //! - a table of knots, together with the associated multiplicities. |
66 | //! The degree of a Geom_BSplineSurface is limited to |
67 | //! a value (25) which is defined and controlled by the |
68 | //! system. This value is returned by the function MaxDegree. |
69 | //! Poles and Weights |
70 | //! Poles and Weights are manipulated using two associative double arrays: |
71 | //! - the poles table, which is a double array of gp_Pnt points, and |
72 | //! - the weights table, which is a double array of reals. |
73 | //! The bounds of the poles and weights arrays are: |
74 | //! - 1 and NbUPoles for the row bounds (provided |
75 | //! that the BSpline surface is not periodic in the u |
76 | //! parametric direction), where NbUPoles is the |
77 | //! number of poles of the surface in the u parametric direction, and |
78 | //! - 1 and NbVPoles for the column bounds (provided |
79 | //! that the BSpline surface is not periodic in the v |
80 | //! parametric direction), where NbVPoles is the |
81 | //! number of poles of the surface in the v parametric direction. |
82 | //! The poles of the surface are the points used to shape |
83 | //! and reshape the surface. They comprise a rectangular network. |
84 | //! If the surface is not periodic: |
85 | //! - The points (1, 1), (NbUPoles, 1), (1, |
86 | //! NbVPoles), and (NbUPoles, NbVPoles) |
87 | //! are the four parametric "corners" of the surface. |
88 | //! - The first column of poles and the last column of |
89 | //! poles define two BSpline curves which delimit the |
90 | //! surface in the v parametric direction. These are the |
91 | //! v isoparametric curves corresponding to the two |
92 | //! bounds of the v parameter. |
93 | //! - The first row of poles and the last row of poles |
94 | //! define two BSpline curves which delimit the surface |
95 | //! in the u parametric direction. These are the u |
96 | //! isoparametric curves corresponding to the two bounds of the u parameter. |
97 | //! If the surface is periodic, these geometric properties are not verified. |
98 | //! It is more difficult to define a geometrical significance |
99 | //! for the weights. However they are useful for |
100 | //! representing a quadric surface precisely. Moreover, if |
101 | //! the weights of all the poles are equal, the surface has |
102 | //! a polynomial equation, and hence is a "non-rational surface". |
103 | //! The non-rational surface is a special, but frequently |
104 | //! used, case, where all poles have identical weights. |
105 | //! The weights are defined and used only in the case of |
106 | //! a rational surface. The rational characteristic is |
107 | //! defined in each parametric direction. A surface can be |
108 | //! rational in the u parametric direction, and |
109 | //! non-rational in the v parametric direction. |
110 | //! Knots and Multiplicities |
111 | //! For a Geom_BSplineSurface the table of knots is |
112 | //! made up of two increasing sequences of reals, without |
113 | //! repetition, one for each parametric direction. The |
114 | //! multiplicities define the repetition of the knots. |
115 | //! A BSpline surface comprises multiple contiguous |
116 | //! patches, which are themselves polynomial or rational |
117 | //! surfaces. The knots are the parameters of the |
118 | //! isoparametric curves which limit these contiguous |
119 | //! patches. The multiplicity of a knot on a BSpline |
120 | //! surface (in a given parametric direction) is related to |
121 | //! the degree of continuity of the surface at that knot in |
122 | //! that parametric direction: |
123 | //! Degree of continuity at knot(i) = Degree - Multi(i) where: |
124 | //! - Degree is the degree of the BSpline surface in |
125 | //! the given parametric direction, and |
126 | //! - Multi(i) is the multiplicity of knot number i in |
127 | //! the given parametric direction. |
128 | //! There are some special cases, where the knots are |
129 | //! regularly spaced in one parametric direction (i.e. the |
130 | //! difference between two consecutive knots is a constant). |
131 | //! - "Uniform": all the multiplicities are equal to 1. |
132 | //! - "Quasi-uniform": all the multiplicities are equal to 1, |
133 | //! except for the first and last knots in this parametric |
134 | //! direction, and these are equal to Degree + 1. |
135 | //! - "Piecewise Bezier": all the multiplicities are equal to |
136 | //! Degree except for the first and last knots, which |
137 | //! are equal to Degree + 1. This surface is a |
138 | //! concatenation of Bezier patches in the given |
139 | //! parametric direction. |
140 | //! If the BSpline surface is not periodic in a given |
141 | //! parametric direction, the bounds of the knots and |
142 | //! multiplicities tables are 1 and NbKnots, where |
143 | //! NbKnots is the number of knots of the BSpline |
144 | //! surface in that parametric direction. |
145 | //! If the BSpline surface is periodic in a given parametric |
146 | //! direction, and there are k periodic knots and p |
147 | //! periodic poles in that parametric direction: |
148 | //! - the period is such that: |
149 | //! period = Knot(k+1) - Knot(1), and |
150 | //! - the poles and knots tables in that parametric |
151 | //! direction can be considered as infinite tables, such that: |
152 | //! Knot(i+k) = Knot(i) + period, and |
153 | //! Pole(i+p) = Pole(i) |
154 | //! Note: The data structure tables for a periodic BSpline |
155 | //! surface are more complex than those of a non-periodic one. |
156 | //! References : |
157 | //! . A survey of curve and surface methods in CADG Wolfgang BOHM |
158 | //! CAGD 1 (1984) |
159 | //! . On de Boor-like algorithms and blossoming Wolfgang BOEHM |
160 | //! cagd 5 (1988) |
161 | //! . Blossoming and knot insertion algorithms for B-spline curves |
162 | //! Ronald N. GOLDMAN |
163 | //! . Modelisation des surfaces en CAO, Henri GIAUME Peugeot SA |
164 | //! . Curves and Surfaces for Computer Aided Geometric Design, |
165 | //! a practical guide Gerald Farin |
166 | class Geom_BSplineSurface : public Geom_BoundedSurface |
167 | { |
168 | |
169 | public: |
170 | |
171 | |
172 | //! Creates a non-rational b-spline surface (weights |
173 | //! default value is 1.). |
174 | //! The following conditions must be verified. |
175 | //! 0 < UDegree <= MaxDegree. |
176 | //! UKnots.Length() == UMults.Length() >= 2 |
177 | //! UKnots(i) < UKnots(i+1) (Knots are increasing) |
178 | //! 1 <= UMults(i) <= UDegree |
179 | //! On a non uperiodic surface the first and last |
180 | //! umultiplicities may be UDegree+1 (this is even |
181 | //! recommanded if you want the curve to start and finish on |
182 | //! the first and last pole). |
183 | //! On a uperiodic surface the first and the last |
184 | //! umultiplicities must be the same. |
185 | //! on non-uperiodic surfaces |
186 | //! Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2 |
187 | //! on uperiodic surfaces |
188 | //! Poles.ColLength() == Sum(UMults(i)) except the first or last |
189 | //! The previous conditions for U holds also for V, with the |
190 | //! RowLength of the poles. |
191 | Standard_EXPORT Geom_BSplineSurface(const TColgp_Array2OfPnt& Poles, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger& UMults, const TColStd_Array1OfInteger& VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean UPeriodic = Standard_False, const Standard_Boolean VPeriodic = Standard_False); |
192 | |
193 | //! Creates a non-rational b-spline surface (weights |
194 | //! default value is 1.). |
195 | //! |
196 | //! The following conditions must be verified. |
197 | //! 0 < UDegree <= MaxDegree. |
198 | //! |
199 | //! UKnots.Length() == UMults.Length() >= 2 |
200 | //! |
201 | //! UKnots(i) < UKnots(i+1) (Knots are increasing) |
202 | //! 1 <= UMults(i) <= UDegree |
203 | //! |
204 | //! On a non uperiodic surface the first and last |
205 | //! umultiplicities may be UDegree+1 (this is even |
206 | //! recommanded if you want the curve to start and finish on |
207 | //! the first and last pole). |
208 | //! |
209 | //! On a uperiodic surface the first and the last |
210 | //! umultiplicities must be the same. |
211 | //! |
212 | //! on non-uperiodic surfaces |
213 | //! |
214 | //! Poles.ColLength() == Sum(UMults(i)) - UDegree - 1 >= 2 |
215 | //! |
216 | //! on uperiodic surfaces |
217 | //! |
218 | //! Poles.ColLength() == Sum(UMults(i)) except the first or |
219 | //! last |
220 | //! |
221 | //! The previous conditions for U holds also for V, with the |
222 | //! RowLength of the poles. |
223 | Standard_EXPORT Geom_BSplineSurface(const TColgp_Array2OfPnt& Poles, const TColStd_Array2OfReal& Weights, const TColStd_Array1OfReal& UKnots, const TColStd_Array1OfReal& VKnots, const TColStd_Array1OfInteger& UMults, const TColStd_Array1OfInteger& VMults, const Standard_Integer UDegree, const Standard_Integer VDegree, const Standard_Boolean UPeriodic = Standard_False, const Standard_Boolean VPeriodic = Standard_False); |
224 | |
225 | //! Exchanges the u and v parametric directions on |
226 | //! this BSpline surface. |
227 | //! As a consequence: |
228 | //! - the poles and weights tables are transposed, |
229 | //! - the knots and multiplicities tables are exchanged, |
230 | //! - degrees of continuity, and rational, periodic and |
231 | //! uniform characteristics are exchanged, and |
232 | //! - the orientation of the surface is inverted. |
233 | Standard_EXPORT void ExchangeUV(); |
234 | |
235 | //! Sets the surface U periodic. |
236 | Standard_EXPORT void SetUPeriodic(); |
237 | |
238 | //! Modifies this surface to be periodic in the u (or v) |
239 | //! parametric direction. |
240 | //! To become periodic in a given parametric direction a |
241 | //! surface must be closed in that parametric direction, |
242 | //! and the knot sequence relative to that direction must be periodic. |
243 | //! To generate this periodic sequence of knots, the |
244 | //! functions FirstUKnotIndex and LastUKnotIndex (or |
245 | //! FirstVKnotIndex and LastVKnotIndex) are used to |
246 | //! compute I1 and I2. These are the indexes, in the |
247 | //! knot array associated with the given parametric |
248 | //! direction, of the knots that correspond to the first and |
249 | //! last parameters of this BSpline surface in the given |
250 | //! parametric direction. Hence the period is: |
251 | //! Knots(I1) - Knots(I2) |
252 | //! As a result, the knots and poles tables are modified. |
253 | //! Exceptions |
254 | //! Standard_ConstructionError if the surface is not |
255 | //! closed in the given parametric direction. |
256 | Standard_EXPORT void SetVPeriodic(); |
257 | |
258 | //! returns the parameter normalized within |
259 | //! the period if the surface is periodic : otherwise |
260 | //! does not do anything |
261 | Standard_EXPORT void PeriodicNormalization (Standard_Real& U, Standard_Real& V) const; |
262 | |
263 | //! Assigns the knot of index Index in the knots table in |
264 | //! the corresponding parametric direction to be the |
265 | //! origin of this periodic BSpline surface. As a |
266 | //! consequence, the knots and poles tables are modified. |
267 | //! Exceptions |
268 | //! Standard_NoSuchObject if this BSpline surface is |
269 | //! not periodic in the given parametric direction. |
270 | //! Standard_DomainError if Index is outside the |
271 | //! bounds of the knots table in the given parametric direction. |
272 | Standard_EXPORT void SetUOrigin (const Standard_Integer Index); |
273 | |
274 | //! Assigns the knot of index Index in the knots table in |
275 | //! the corresponding parametric direction to be the |
276 | //! origin of this periodic BSpline surface. As a |
277 | //! consequence, the knots and poles tables are modified. |
278 | //! Exceptions |
279 | //! Standard_NoSuchObject if this BSpline surface is |
280 | //! not periodic in the given parametric direction. |
281 | //! Standard_DomainError if Index is outside the |
282 | //! bounds of the knots table in the given parametric direction. |
283 | Standard_EXPORT void SetVOrigin (const Standard_Integer Index); |
284 | |
285 | Standard_EXPORT void SetUNotPeriodic(); |
286 | |
287 | //! Modifies this surface to be periodic in the u (or v) parametric direction. |
288 | //! To become periodic in a given parametric direction a |
289 | //! surface must be closed in that parametric direction, |
290 | //! and the knot sequence relative to that direction must be periodic. |
291 | //! To generate this periodic sequence of knots, the |
292 | //! functions FirstUKnotIndex and LastUKnotIndex (or |
293 | //! FirstVKnotIndex and LastVKnotIndex) are used to |
294 | //! compute I1 and I2. These are the indexes, in the |
295 | //! knot array associated with the given parametric |
296 | //! direction, of the knots that correspond to the first and |
297 | //! last parameters of this BSpline surface in the given |
298 | //! parametric direction. Hence the period is: |
299 | //! Knots(I1) - Knots(I2) |
300 | //! As a result, the knots and poles tables are modified. |
301 | //! Exceptions |
302 | //! Standard_ConstructionError if the surface is not |
303 | //! closed in the given parametric direction. |
304 | Standard_EXPORT void SetVNotPeriodic(); |
305 | |
306 | Standard_EXPORT void UReverse(); |
307 | |
308 | //! Changes the orientation of this BSpline surface in the |
309 | //! u (or v) parametric direction. The bounds of the |
310 | //! surface are not changed but the given parametric |
311 | //! direction is reversed. Hence the orientation of the |
312 | //! surface is reversed. |
313 | //! The knots and poles tables are modified. |
314 | Standard_EXPORT void VReverse(); |
315 | |
316 | Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const; |
317 | |
318 | //! Computes the u (or v) parameter on the modified |
319 | //! surface, produced by reversing its u (or v) parametric |
320 | //! direction, for the point of u parameter U, (or of v |
321 | //! parameter V) on this BSpline surface. |
322 | //! For a BSpline surface, these functions return respectively: |
323 | //! - UFirst + ULast - U, or |
324 | //! - VFirst + VLast - V, |
325 | //! where UFirst, ULast, VFirst and VLast are |
326 | //! the values of the first and last parameters of this |
327 | //! BSpline surface, in the u and v parametric directions. |
328 | Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const; |
329 | |
330 | //! Increases the degrees of this BSpline surface to |
331 | //! UDegree and VDegree in the u and v parametric |
332 | //! directions respectively. As a result, the tables of poles, |
333 | //! weights and multiplicities are modified. The tables of |
334 | //! knots is not changed. |
335 | //! Note: Nothing is done if the given degree is less than |
336 | //! or equal to the current degree in the corresponding |
337 | //! parametric direction. |
338 | //! Exceptions |
339 | //! Standard_ConstructionError if UDegree or |
340 | //! VDegree is greater than |
341 | //! Geom_BSplineSurface::MaxDegree(). |
342 | Standard_EXPORT void IncreaseDegree (const Standard_Integer UDegree, const Standard_Integer VDegree); |
343 | |
344 | Standard_EXPORT void InsertUKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True); |
345 | |
346 | //! Inserts into the knots table for the corresponding |
347 | //! parametric direction of this BSpline surface: |
348 | //! - the value U, or V, with the multiplicity M (defaulted to 1), or |
349 | //! - the values of the array Knots, with their respective |
350 | //! multiplicities, Mults. |
351 | //! If the knot value to insert already exists in the table, its multiplicity is: |
352 | //! - increased by M, if Add is true (the default), or |
353 | //! - increased to M, if Add is false. |
354 | //! The tolerance criterion used to check the equality of |
355 | //! the knots is the larger of the values ParametricTolerance and |
356 | //! Standard_Real::Epsilon(val), where val is the knot value to be inserted. |
357 | //! Warning |
358 | //! - If a given multiplicity coefficient is null, or negative, nothing is done. |
359 | //! - The new multiplicity of a knot is limited to the degree of this BSpline surface in the |
360 | //! corresponding parametric direction. |
361 | //! Exceptions |
362 | //! Standard_ConstructionError if a knot value to |
363 | //! insert is outside the bounds of this BSpline surface in |
364 | //! the specified parametric direction. The comparison |
365 | //! uses the precision criterion ParametricTolerance. |
366 | Standard_EXPORT void InsertVKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True); |
367 | |
368 | Standard_EXPORT Standard_Boolean RemoveUKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance); |
369 | |
370 | //! Reduces to M the multiplicity of the knot of index |
371 | //! Index in the given parametric direction. If M is 0, the knot is removed. |
372 | //! With a modification of this type, the table of poles is also modified. |
373 | //! Two different algorithms are used systematically to |
374 | //! compute the new poles of the surface. For each |
375 | //! pole, the distance between the pole calculated |
376 | //! using the first algorithm and the same pole |
377 | //! calculated using the second algorithm, is checked. If |
378 | //! this distance is less than Tolerance it ensures that |
379 | //! the surface is not modified by more than Tolerance. |
380 | //! Under these conditions, the function returns true; |
381 | //! otherwise, it returns false. |
382 | //! A low tolerance prevents modification of the |
383 | //! surface. A high tolerance "smoothes" the surface. |
384 | //! Exceptions |
385 | //! Standard_OutOfRange if Index is outside the |
386 | //! bounds of the knots table of this BSpline surface. |
387 | Standard_EXPORT Standard_Boolean RemoveVKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance); |
388 | |
389 | |
390 | //! Increases the multiplicity of the knot of range UIndex |
391 | //! in the UKnots sequence. |
392 | //! M is the new multiplicity. M must be greater than the |
393 | //! previous multiplicity and lower or equal to the degree |
394 | //! of the surface in the U parametric direction. |
395 | //! Raised if M is not in the range [1, UDegree] |
396 | //! |
397 | //! Raised if UIndex is not in the range [FirstUKnotIndex, |
398 | //! LastUKnotIndex] given by the methods with the same name. |
399 | Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer UIndex, const Standard_Integer M); |
400 | |
401 | |
402 | //! Increases until order M the multiplicity of the set of knots |
403 | //! FromI1,...., ToI2 in the U direction. This method can be used |
404 | //! to make a B_spline surface into a PiecewiseBezier B_spline |
405 | //! surface. |
406 | //! If <me> was uniform, it can become non uniform. |
407 | //! |
408 | //! Raised if FromI1 or ToI2 is out of the range [FirstUKnotIndex, |
409 | //! LastUKnotIndex]. |
410 | //! |
411 | //! M should be greater than the previous multiplicity of the |
412 | //! all the knots FromI1,..., ToI2 and lower or equal to the |
413 | //! Degree of the surface in the U parametric direction. |
414 | Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M); |
415 | |
416 | |
417 | //! Increments the multiplicity of the consecutives uknots FromI1..ToI2 |
418 | //! by step. The multiplicity of each knot FromI1,.....,ToI2 must be |
419 | //! lower or equal to the UDegree of the B_spline. |
420 | //! |
421 | //! Raised if FromI1 or ToI2 is not in the range |
422 | //! [FirstUKnotIndex, LastUKnotIndex] |
423 | //! |
424 | //! Raised if one knot has a multiplicity greater than UDegree. |
425 | Standard_EXPORT void IncrementUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step); |
426 | |
427 | |
428 | //! Increases the multiplicity of a knot in the V direction. |
429 | //! M is the new multiplicity. |
430 | //! |
431 | //! M should be greater than the previous multiplicity and lower |
432 | //! than the degree of the surface in the V parametric direction. |
433 | //! |
434 | //! Raised if VIndex is not in the range [FirstVKnotIndex, |
435 | //! LastVKnotIndex] given by the methods with the same name. |
436 | Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer VIndex, const Standard_Integer M); |
437 | |
438 | |
439 | //! Increases until order M the multiplicity of the set of knots |
440 | //! FromI1,...., ToI2 in the V direction. This method can be used to |
441 | //! make a BSplineSurface into a PiecewiseBezier B_spline |
442 | //! surface. If <me> was uniform, it can become non-uniform. |
443 | //! |
444 | //! Raised if FromI1 or ToI2 is out of the range [FirstVKnotIndex, |
445 | //! LastVKnotIndex] given by the methods with the same name. |
446 | //! |
447 | //! M should be greater than the previous multiplicity of the |
448 | //! all the knots FromI1,..., ToI2 and lower or equal to the |
449 | //! Degree of the surface in the V parametric direction. |
450 | Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M); |
451 | |
452 | |
453 | //! Increments the multiplicity of the consecutives vknots FromI1..ToI2 |
454 | //! by step. The multiplicity of each knot FromI1,.....,ToI2 must be |
455 | //! lower or equal to the VDegree of the B_spline. |
456 | //! |
457 | //! Raised if FromI1 or ToI2 is not in the range |
458 | //! [FirstVKnotIndex, LastVKnotIndex] |
459 | //! |
460 | //! Raised if one knot has a multiplicity greater than VDegree. |
461 | Standard_EXPORT void IncrementVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step); |
462 | |
463 | |
464 | //! Inserts a knot value in the sequence of UKnots. If U is a knot |
465 | //! value this method increases the multiplicity of the knot if the |
466 | //! previous multiplicity was lower than M else it does nothing. The |
467 | //! tolerance criterion is ParametricTolerance. ParametricTolerance |
468 | //! should be greater or equal than Resolution from package gp. |
469 | //! |
470 | //! Raised if U is out of the bounds [U1, U2] given by the methods |
471 | //! Bounds, the criterion ParametricTolerance is used. |
472 | //! Raised if M is not in the range [1, UDegree]. |
473 | Standard_EXPORT void InsertUKnot (const Standard_Real U, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True); |
474 | |
475 | |
476 | //! Inserts a knot value in the sequence of VKnots. If V is a knot |
477 | //! value this method increases the multiplicity of the knot if the |
478 | //! previous multiplicity was lower than M otherwise it does nothing. |
479 | //! The tolerance criterion is ParametricTolerance. |
480 | //! ParametricTolerance should be greater or equal than Resolution |
481 | //! from package gp. |
482 | //! |
483 | //! raises if V is out of the Bounds [V1, V2] given by the methods |
484 | //! Bounds, the criterion ParametricTolerance is used. |
485 | //! raises if M is not in the range [1, VDegree]. |
486 | Standard_EXPORT void InsertVKnot (const Standard_Real V, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True); |
487 | |
488 | |
489 | //! Segments the surface between U1 and U2 in the U-Direction. |
490 | //! between V1 and V2 in the V-Direction. |
491 | //! The control points are modified, the first and the last point |
492 | //! are not the same. |
493 | //! Warnings : |
494 | //! Even if <me> is not closed it can become closed after the |
495 | //! segmentation for example if U1 or U2 are out of the bounds |
496 | //! of the surface <me> or if the surface makes loop. |
497 | //! raises if U2 < U1 or V2 < V1 |
498 | Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2); |
499 | |
500 | |
501 | //! Segments the surface between U1 and U2 in the U-Direction. |
502 | //! between V1 and V2 in the V-Direction. |
503 | //! |
504 | //! same as Segment but do nothing if U1 and U2 (resp. V1 and V2) are |
505 | //! equal to the bounds in U (resp. in V) of <me>. |
506 | //! For example, if <me> is periodic in V, it will be always periodic |
507 | //! in V after the segmentation if the bounds in V are unchanged |
508 | //! |
509 | //! Warnings : |
510 | //! Even if <me> is not closed it can become closed after the |
511 | //! segmentation for example if U1 or U2 are out of the bounds |
512 | //! of the surface <me> or if the surface makes loop. |
513 | //! raises if U2 < U1 or V2 < V1 |
514 | Standard_EXPORT void CheckAndSegment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2); |
515 | |
516 | //! Substitutes the UKnots of range UIndex with K. |
517 | //! |
518 | //! Raised if UIndex < 1 or UIndex > NbUKnots |
519 | //! |
520 | //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1) |
521 | Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K); |
522 | |
523 | //! Changes all the U-knots of the surface. |
524 | //! The multiplicity of the knots are not modified. |
525 | //! |
526 | //! Raised if there is an index such that UK (Index+1) <= UK (Index). |
527 | //! |
528 | //! Raised if UK.Lower() < 1 or UK.Upper() > NbUKnots |
529 | Standard_EXPORT void SetUKnots (const TColStd_Array1OfReal& UK); |
530 | |
531 | |
532 | //! Changes the value of the UKnots of range UIndex and |
533 | //! increases its multiplicity. |
534 | //! |
535 | //! Raised if UIndex is not in the range [FirstUKnotIndex, |
536 | //! LastUKnotIndex] given by the methods with the same name. |
537 | //! |
538 | //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1) |
539 | //! M must be lower than UDegree and greater than the previous |
540 | //! multiplicity of the knot of range UIndex. |
541 | Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K, const Standard_Integer M); |
542 | |
543 | //! Substitutes the VKnots of range VIndex with K. |
544 | //! |
545 | //! Raised if VIndex < 1 or VIndex > NbVKnots |
546 | //! |
547 | //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1) |
548 | Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K); |
549 | |
550 | //! Changes all the V-knots of the surface. |
551 | //! The multiplicity of the knots are not modified. |
552 | //! |
553 | //! Raised if there is an index such that VK (Index+1) <= VK (Index). |
554 | //! |
555 | //! Raised if VK.Lower() < 1 or VK.Upper() > NbVKnots |
556 | Standard_EXPORT void SetVKnots (const TColStd_Array1OfReal& VK); |
557 | |
558 | |
559 | //! Changes the value of the VKnots of range VIndex and increases |
560 | //! its multiplicity. |
561 | //! |
562 | //! Raised if VIndex is not in the range [FirstVKnotIndex, |
563 | //! LastVKnotIndex] given by the methods with the same name. |
564 | //! |
565 | //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1) |
566 | //! M must be lower than VDegree and greater than the previous |
567 | //! multiplicity of the knot of range VIndex. |
568 | Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K, const Standard_Integer M); |
569 | |
570 | |
571 | //! Locates the parametric value U in the sequence of UKnots. |
572 | //! If "WithKnotRepetition" is True we consider the knot's |
573 | //! representation with repetition of multiple knot value, |
574 | //! otherwise we consider the knot's representation with |
575 | //! no repetition of multiple knot values. |
576 | //! UKnots (I1) <= U <= UKnots (I2) |
577 | //! . if I1 = I2 U is a knot value (the tolerance criterion |
578 | //! ParametricTolerance is used). |
579 | //! . if I1 < 1 => U < UKnots(1) - Abs(ParametricTolerance) |
580 | //! . if I2 > NbUKnots => U > UKnots(NbUKnots)+Abs(ParametricTolerance) |
581 | 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; |
582 | |
583 | |
584 | //! Locates the parametric value U in the sequence of knots. |
585 | //! If "WithKnotRepetition" is True we consider the knot's |
586 | //! representation with repetition of multiple knot value, |
587 | //! otherwise we consider the knot's representation with |
588 | //! no repetition of multiple knot values. |
589 | //! VKnots (I1) <= V <= VKnots (I2) |
590 | //! . if I1 = I2 V is a knot value (the tolerance criterion |
591 | //! ParametricTolerance is used). |
592 | //! . if I1 < 1 => V < VKnots(1) - Abs(ParametricTolerance) |
593 | //! . if I2 > NbVKnots => V > VKnots(NbVKnots)+Abs(ParametricTolerance) |
594 | //! poles insertion and removing |
595 | //! The following methods are available only if the surface |
596 | //! is Uniform or QuasiUniform in the considered direction |
597 | //! The knot repartition is modified. |
598 | Standard_EXPORT void LocateV (const Standard_Real V, const Standard_Real ParametricTolerance, Standard_Integer& I1, Standard_Integer& I2, const Standard_Boolean WithKnotRepetition = Standard_False) const; |
599 | |
600 | |
601 | //! Substitutes the pole of range (UIndex, VIndex) with P. |
602 | //! If the surface is rational the weight of range (UIndex, VIndex) |
603 | //! is not modified. |
604 | //! |
605 | //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
606 | //! VIndex > NbVPoles. |
607 | Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P); |
608 | |
609 | |
610 | //! Substitutes the pole and the weight of range (UIndex, VIndex) |
611 | //! with P and W. |
612 | //! |
613 | //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
614 | //! VIndex > NbVPoles. |
615 | //! Raised if Weight <= Resolution from package gp. |
616 | Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P, const Standard_Real Weight); |
617 | |
618 | |
619 | //! Changes a column of poles or a part of this column. |
620 | //! Raised if Vindex < 1 or VIndex > NbVPoles. |
621 | //! |
622 | //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles. |
623 | Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles); |
624 | |
625 | |
626 | //! Changes a column of poles or a part of this column with the |
627 | //! corresponding weights. If the surface was rational it can |
628 | //! become non rational. If the surface was non rational it can |
629 | //! become rational. |
630 | //! Raised if Vindex < 1 or VIndex > NbVPoles. |
631 | //! |
632 | //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles |
633 | //! Raised if the bounds of CPoleWeights are not the same as the |
634 | //! bounds of CPoles. |
635 | //! Raised if one of the weight value of CPoleWeights is lower or |
636 | //! equal to Resolution from package gp. |
637 | Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights); |
638 | |
639 | |
640 | //! Changes a row of poles or a part of this row with the |
641 | //! corresponding weights. If the surface was rational it can |
642 | //! become non rational. If the surface was non rational it can |
643 | //! become rational. |
644 | //! Raised if Uindex < 1 or UIndex > NbUPoles. |
645 | //! |
646 | //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles |
647 | //! raises if the bounds of CPoleWeights are not the same as the |
648 | //! bounds of CPoles. |
649 | //! Raised if one of the weight value of CPoleWeights is lower or |
650 | //! equal to Resolution from package gp. |
651 | Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights); |
652 | |
653 | |
654 | //! Changes a row of poles or a part of this row. |
655 | //! Raised if Uindex < 1 or UIndex > NbUPoles. |
656 | //! |
657 | //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles. |
658 | Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles); |
659 | |
660 | |
661 | //! Changes the weight of the pole of range UIndex, VIndex. |
662 | //! If the surface was non rational it can become rational. |
663 | //! If the surface was rational it can become non rational. |
664 | //! |
665 | //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
666 | //! VIndex > NbVPoles |
667 | //! |
668 | //! Raised if weight is lower or equal to Resolution from |
669 | //! package gp |
670 | Standard_EXPORT void SetWeight (const Standard_Integer UIndex, const Standard_Integer VIndex, const Standard_Real Weight); |
671 | |
672 | |
673 | //! Changes a column of weights of a part of this column. |
674 | //! |
675 | //! Raised if VIndex < 1 or VIndex > NbVPoles |
676 | //! |
677 | //! Raised if CPoleWeights.Lower() < 1 or |
678 | //! CPoleWeights.Upper() > NbUPoles. |
679 | //! Raised if a weight value is lower or equal to Resolution |
680 | //! from package gp. |
681 | Standard_EXPORT void SetWeightCol (const Standard_Integer VIndex, const TColStd_Array1OfReal& CPoleWeights); |
682 | |
683 | |
684 | //! Changes a row of weights or a part of this row. |
685 | //! |
686 | //! Raised if UIndex < 1 or UIndex > NbUPoles |
687 | //! |
688 | //! Raised if CPoleWeights.Lower() < 1 or |
689 | //! CPoleWeights.Upper() > NbVPoles. |
690 | //! Raised if a weight value is lower or equal to Resolution |
691 | //! from package gp. |
692 | Standard_EXPORT void SetWeightRow (const Standard_Integer UIndex, const TColStd_Array1OfReal& CPoleWeights); |
693 | |
694 | //! Move a point with parameter U and V to P. |
695 | //! given u,v as parameters) to reach a new position |
696 | //! UIndex1, UIndex2, VIndex1, VIndex2: |
697 | //! indicates the poles which can be moved |
698 | //! if Problem in BSplineBasis calculation, no change |
699 | //! for the curve and |
700 | //! UFirstIndex, VLastIndex = 0 |
701 | //! VFirstIndex, VLastIndex = 0 |
702 | //! |
703 | //! Raised if UIndex1 < UIndex2 or VIndex1 < VIndex2 or |
704 | //! UIndex1 < 1 || UIndex1 > NbUPoles or |
705 | //! UIndex2 < 1 || UIndex2 > NbUPoles |
706 | //! VIndex1 < 1 || VIndex1 > NbVPoles or |
707 | //! VIndex2 < 1 || VIndex2 > NbVPoles |
708 | //! characteristics of the surface |
709 | Standard_EXPORT void MovePoint (const Standard_Real U, const Standard_Real V, const gp_Pnt& P, const Standard_Integer UIndex1, const Standard_Integer UIndex2, const Standard_Integer VIndex1, const Standard_Integer VIndex2, Standard_Integer& UFirstIndex, Standard_Integer& ULastIndex, Standard_Integer& VFirstIndex, Standard_Integer& VLastIndex); |
710 | |
711 | |
712 | //! Returns true if the first control points row and the last |
713 | //! control points row are identical. The tolerance criterion |
714 | //! is Resolution from package gp. |
715 | Standard_EXPORT Standard_Boolean IsUClosed() const; |
716 | |
717 | |
718 | //! Returns true if the first control points column and the |
719 | //! last last control points column are identical. |
720 | //! The tolerance criterion is Resolution from package gp. |
721 | Standard_EXPORT Standard_Boolean IsVClosed() const; |
722 | |
723 | |
724 | //! Returns True if the order of continuity of the surface in the |
725 | //! U direction is N. |
726 | //! Raised if N < 0. |
727 | Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const; |
728 | |
729 | |
730 | //! Returns True if the order of continuity of the surface |
731 | //! in the V direction is N. |
732 | //! Raised if N < 0. |
733 | Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const; |
734 | |
735 | |
736 | //! Returns True if the surface is closed in the U direction |
737 | //! and if the B-spline has been turned into a periodic surface |
738 | //! using the function SetUPeriodic. |
739 | Standard_EXPORT Standard_Boolean IsUPeriodic() const; |
740 | |
741 | |
742 | //! Returns False if for each row of weights all the weights |
743 | //! are identical. |
744 | //! The tolerance criterion is resolution from package gp. |
745 | //! Example : |
746 | //! |1.0, 1.0, 1.0| |
747 | //! if Weights = |0.5, 0.5, 0.5| returns False |
748 | //! |2.0, 2.0, 2.0| |
749 | Standard_EXPORT Standard_Boolean IsURational() const; |
750 | |
751 | |
752 | //! Returns True if the surface is closed in the V direction |
753 | //! and if the B-spline has been turned into a periodic |
754 | //! surface using the function SetVPeriodic. |
755 | Standard_EXPORT Standard_Boolean IsVPeriodic() const; |
756 | |
757 | |
758 | //! Returns False if for each column of weights all the weights |
759 | //! are identical. |
760 | //! The tolerance criterion is resolution from package gp. |
761 | //! Examples : |
762 | //! |1.0, 2.0, 0.5| |
763 | //! if Weights = |1.0, 2.0, 0.5| returns False |
764 | //! |1.0, 2.0, 0.5| |
765 | Standard_EXPORT Standard_Boolean IsVRational() const; |
766 | |
767 | |
768 | //! Returns the parametric bounds of the surface. |
769 | //! Warnings : |
770 | //! These parametric values are the bounds of the array of |
771 | //! knots UKnots and VKnots only if the first knots and the |
772 | //! last knots have a multiplicity equal to UDegree + 1 or |
773 | //! VDegree + 1 |
774 | Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const; |
775 | |
776 | |
777 | //! Returns the continuity of the surface : |
778 | //! C0 : only geometric continuity, |
779 | //! C1 : continuity of the first derivative all along the Surface, |
780 | //! C2 : continuity of the second derivative all along the Surface, |
781 | //! C3 : continuity of the third derivative all along the Surface, |
782 | //! CN : the order of continuity is infinite. |
783 | //! A B-spline surface is infinitely continuously differentiable |
784 | //! for the couple of parameters U, V such thats U != UKnots(i) |
785 | //! and V != VKnots(i). The continuity of the surface at a knot |
786 | //! value depends on the multiplicity of this knot. |
787 | //! Example : |
788 | //! If the surface is C1 in the V direction and C2 in the U |
789 | //! direction this function returns Shape = C1. |
790 | Standard_EXPORT GeomAbs_Shape Continuity() const; |
791 | |
792 | |
793 | //! Computes the Index of the UKnots which gives the first |
794 | //! parametric value of the surface in the U direction. |
795 | //! The UIso curve corresponding to this value is a |
796 | //! boundary curve of the surface. |
797 | Standard_EXPORT Standard_Integer FirstUKnotIndex() const; |
798 | |
799 | |
800 | //! Computes the Index of the VKnots which gives the |
801 | //! first parametric value of the surface in the V direction. |
802 | //! The VIso curve corresponding to this knot is a boundary |
803 | //! curve of the surface. |
804 | Standard_EXPORT Standard_Integer FirstVKnotIndex() const; |
805 | |
806 | |
807 | //! Computes the Index of the UKnots which gives the |
808 | //! last parametric value of the surface in the U direction. |
809 | //! The UIso curve corresponding to this knot is a boundary |
810 | //! curve of the surface. |
811 | Standard_EXPORT Standard_Integer LastUKnotIndex() const; |
812 | |
813 | |
814 | //! Computes the Index of the VKnots which gives the |
815 | //! last parametric value of the surface in the V direction. |
816 | //! The VIso curve corresponding to this knot is a |
817 | //! boundary curve of the surface. |
818 | Standard_EXPORT Standard_Integer LastVKnotIndex() const; |
819 | |
820 | //! Returns the number of knots in the U direction. |
821 | Standard_EXPORT Standard_Integer NbUKnots() const; |
822 | |
823 | //! Returns number of poles in the U direction. |
824 | Standard_EXPORT Standard_Integer NbUPoles() const; |
825 | |
826 | //! Returns the number of knots in the V direction. |
827 | Standard_EXPORT Standard_Integer NbVKnots() const; |
828 | |
829 | //! Returns the number of poles in the V direction. |
830 | Standard_EXPORT Standard_Integer NbVPoles() const; |
831 | |
832 | |
833 | //! Returns the pole of range (UIndex, VIndex). |
834 | //! |
835 | //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or |
836 | //! VIndex > NbVPoles. |
837 | Standard_EXPORT gp_Pnt Pole (const Standard_Integer UIndex, const Standard_Integer VIndex) const; |
838 | |
839 | //! Returns the poles of the B-spline surface. |
840 | //! |
841 | //! Raised if the length of P in the U and V direction |
842 | //! is not equal to NbUpoles and NbVPoles. |
843 | Standard_EXPORT void Poles (TColgp_Array2OfPnt& P) const; |
844 | |
845 | //! Returns the poles of the B-spline surface. |
846 | Standard_EXPORT const TColgp_Array2OfPnt& Poles() const; |
847 | |
848 | |
849 | //! Returns the degree of the normalized B-splines Ni,n in the U |
850 | //! direction. |
851 | Standard_EXPORT Standard_Integer UDegree() const; |
852 | |
853 | |
854 | //! Returns the Knot value of range UIndex. |
855 | //! Raised if UIndex < 1 or UIndex > NbUKnots |
856 | Standard_EXPORT Standard_Real UKnot (const Standard_Integer UIndex) const; |
857 | |
858 | |
859 | //! Returns NonUniform or Uniform or QuasiUniform or |
860 | //! PiecewiseBezier. If all the knots differ by a |
861 | //! positive constant from the preceding knot in the U |
862 | //! direction the B-spline surface can be : |
863 | //! - Uniform if all the knots are of multiplicity 1, |
864 | //! - QuasiUniform if all the knots are of multiplicity 1 |
865 | //! except for the first and last knot which are of |
866 | //! multiplicity Degree + 1, |
867 | //! - PiecewiseBezier if the first and last knots have |
868 | //! multiplicity Degree + 1 and if interior knots have |
869 | //! multiplicity Degree |
870 | //! otherwise the surface is non uniform in the U direction |
871 | //! The tolerance criterion is Resolution from package gp. |
872 | Standard_EXPORT GeomAbs_BSplKnotDistribution UKnotDistribution() const; |
873 | |
874 | //! Returns the knots in the U direction. |
875 | //! |
876 | //! Raised if the length of Ku is not equal to the number of knots |
877 | //! in the U direction. |
878 | Standard_EXPORT void UKnots (TColStd_Array1OfReal& Ku) const; |
879 | |
880 | //! Returns the knots in the U direction. |
881 | Standard_EXPORT const TColStd_Array1OfReal& UKnots() const; |
882 | |
883 | //! Returns the uknots sequence. |
884 | //! In this sequence the knots with a multiplicity greater than 1 |
885 | //! are repeated. |
886 | //! Example : |
887 | //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
888 | //! |
889 | //! Raised if the length of Ku is not equal to NbUPoles + UDegree + 1 |
890 | Standard_EXPORT void UKnotSequence (TColStd_Array1OfReal& Ku) const; |
891 | |
892 | //! Returns the uknots sequence. |
893 | //! In this sequence the knots with a multiplicity greater than 1 |
894 | //! are repeated. |
895 | //! Example : |
896 | //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
897 | Standard_EXPORT const TColStd_Array1OfReal& UKnotSequence() const; |
898 | |
899 | |
900 | //! Returns the multiplicity value of knot of range UIndex in |
901 | //! the u direction. |
902 | //! Raised if UIndex < 1 or UIndex > NbUKnots. |
903 | Standard_EXPORT Standard_Integer UMultiplicity (const Standard_Integer UIndex) const; |
904 | |
905 | |
906 | //! Returns the multiplicities of the knots in the U direction. |
907 | //! |
908 | //! Raised if the length of Mu is not equal to the number of |
909 | //! knots in the U direction. |
910 | Standard_EXPORT void UMultiplicities (TColStd_Array1OfInteger& Mu) const; |
911 | |
912 | //! Returns the multiplicities of the knots in the U direction. |
913 | Standard_EXPORT const TColStd_Array1OfInteger& UMultiplicities() const; |
914 | |
915 | |
916 | //! Returns the degree of the normalized B-splines Ni,d in the |
917 | //! V direction. |
918 | Standard_EXPORT Standard_Integer VDegree() const; |
919 | |
920 | //! Returns the Knot value of range VIndex. |
921 | Standard_EXPORT Standard_Real VKnot (const Standard_Integer VIndex) const; |
922 | |
923 | |
924 | //! Returns NonUniform or Uniform or QuasiUniform or |
925 | //! PiecewiseBezier. If all the knots differ by a positive |
926 | //! constant from the preceding knot in the V direction the |
927 | //! B-spline surface can be : |
928 | //! - Uniform if all the knots are of multiplicity 1, |
929 | //! - QuasiUniform if all the knots are of multiplicity 1 |
930 | //! except for the first and last knot which are of |
931 | //! multiplicity Degree + 1, |
932 | //! - PiecewiseBezier if the first and last knots have |
933 | //! multiplicity Degree + 1 and if interior knots have |
934 | //! multiplicity Degree |
935 | //! otherwise the surface is non uniform in the V direction. |
936 | //! The tolerance criterion is Resolution from package gp. |
937 | Standard_EXPORT GeomAbs_BSplKnotDistribution VKnotDistribution() const; |
938 | |
939 | //! Returns the knots in the V direction. |
940 | //! |
941 | //! Raised if the length of Kv is not equal to the number of |
942 | //! knots in the V direction. |
943 | Standard_EXPORT void VKnots (TColStd_Array1OfReal& Kv) const; |
944 | |
945 | //! Returns the knots in the V direction. |
946 | Standard_EXPORT const TColStd_Array1OfReal& VKnots() const; |
947 | |
948 | //! Returns the vknots sequence. |
949 | //! In this sequence the knots with a multiplicity greater than 1 |
950 | //! are repeated. |
951 | //! Example : |
952 | //! Kv = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
953 | //! |
954 | //! Raised if the length of Kv is not equal to NbVPoles + VDegree + 1 |
955 | Standard_EXPORT void VKnotSequence (TColStd_Array1OfReal& Kv) const; |
956 | |
957 | //! Returns the vknots sequence. |
958 | //! In this sequence the knots with a multiplicity greater than 1 |
959 | //! are repeated. |
960 | //! Example : |
961 | //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4} |
962 | Standard_EXPORT const TColStd_Array1OfReal& VKnotSequence() const; |
963 | |
964 | |
965 | //! Returns the multiplicity value of knot of range VIndex in |
966 | //! the v direction. |
967 | //! Raised if VIndex < 1 or VIndex > NbVKnots |
968 | Standard_EXPORT Standard_Integer VMultiplicity (const Standard_Integer VIndex) const; |
969 | |
970 | |
971 | //! Returns the multiplicities of the knots in the V direction. |
972 | //! |
973 | //! Raised if the length of Mv is not equal to the number of |
974 | //! knots in the V direction. |
975 | Standard_EXPORT void VMultiplicities (TColStd_Array1OfInteger& Mv) const; |
976 | |
977 | //! Returns the multiplicities of the knots in the V direction. |
978 | Standard_EXPORT const TColStd_Array1OfInteger& VMultiplicities() const; |
979 | |
980 | //! Returns the weight value of range UIndex, VIndex. |
981 | //! |
982 | //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 |
983 | //! or VIndex > NbVPoles. |
984 | Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const; |
985 | |
986 | //! Returns the weights of the B-spline surface. |
987 | //! |
988 | //! Raised if the length of W in the U and V direction is |
989 | //! not equal to NbUPoles and NbVPoles. |
990 | Standard_EXPORT void Weights (TColStd_Array2OfReal& W) const; |
991 | |
992 | //! Returns the weights of the B-spline surface. |
993 | //! value and derivatives computation |
0e14656b |
994 | Standard_EXPORT const TColStd_Array2OfReal* Weights() const; |
42cf5bc1 |
995 | |
996 | Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const; |
997 | |
998 | //! Raised if the continuity of the surface is not C1. |
999 | Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const; |
1000 | |
1001 | //! Raised if the continuity of the surface is not C2. |
1002 | Standard_EXPORT void D2 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const; |
1003 | |
1004 | //! Raised if the continuity of the surface is not C3. |
1005 | Standard_EXPORT void D3 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const; |
1006 | |
1007 | |
1008 | //! Nu is the order of derivation in the U parametric direction and |
1009 | //! Nv is the order of derivation in the V parametric direction. |
1010 | //! |
1011 | //! Raised if the continuity of the surface is not CNu in the U |
1012 | //! direction and CNv in the V direction. |
1013 | //! |
1014 | //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0. |
1015 | //! |
1016 | //! The following functions computes the point for the |
1017 | //! parametric values (U, V) and the derivatives at |
1018 | //! this point on the B-spline surface patch delimited |
1019 | //! with the knots FromUK1, FromVK1 and the knots ToUK2, |
1020 | //! ToVK2. (U, V) can be out of these parametric bounds |
1021 | //! but for the computation we only use the definition |
1022 | //! of the surface between these knots. This method is |
1023 | //! useful to compute local derivative, if the order of |
1024 | //! continuity of the whole surface is not greater enough. |
1025 | //! Inside the parametric knot's domain previously defined |
1026 | //! the evaluations are the same as if we consider the whole |
1027 | //! definition of the surface. Of course the evaluations are |
1028 | //! different outside this parametric domain. |
1029 | Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const; |
1030 | |
1031 | //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1032 | //! |
1033 | //! Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1034 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1035 | //! [FirstVKnotIndex, LastVKnotIndex] |
1036 | Standard_EXPORT void LocalD0 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P) const; |
1037 | |
1038 | |
1039 | //! Raised if the local continuity of the surface is not C1 |
1040 | //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1041 | //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1042 | //! |
1043 | //! Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1044 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1045 | //! [FirstVKnotIndex, LastVKnotIndex] |
1046 | Standard_EXPORT void LocalD1 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const; |
1047 | |
1048 | |
1049 | //! Raised if the local continuity of the surface is not C2 |
1050 | //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1051 | //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1052 | //! |
1053 | //! Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1054 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1055 | //! [FirstVKnotIndex, LastVKnotIndex] |
1056 | Standard_EXPORT void LocalD2 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV) const; |
1057 | |
1058 | |
1059 | //! Raised if the local continuity of the surface is not C3 |
1060 | //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2. |
1061 | //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1062 | //! |
1063 | //! Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1064 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1065 | //! [FirstVKnotIndex, LastVKnotIndex] |
1066 | Standard_EXPORT void LocalD3 (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V, gp_Vec& D2U, gp_Vec& D2V, gp_Vec& D2UV, gp_Vec& D3U, gp_Vec& D3V, gp_Vec& D3UUV, gp_Vec& D3UVV) const; |
1067 | |
1068 | |
1069 | //! Raised if the local continuity of the surface is not CNu |
1070 | //! between the knots FromUK1, ToUK2 and CNv between the knots |
1071 | //! FromVK1, ToVK2. |
1072 | //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1073 | //! |
1074 | //! Raised if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1075 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1076 | //! [FirstVKnotIndex, LastVKnotIndex] |
1077 | Standard_EXPORT gp_Vec LocalDN (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2, const Standard_Integer Nu, const Standard_Integer Nv) const; |
1078 | |
1079 | |
1080 | //! Computes the point of parameter U, V on the BSpline surface patch |
1081 | //! defines between the knots UK1 UK2, VK1, VK2. U can be out of the |
1082 | //! bounds [Knot UK1, Knot UK2] and V can be outof the bounds |
1083 | //! [Knot VK1, Knot VK2] but for the computation we only use the |
1084 | //! definition of the surface between these knot values. |
1085 | //! Raises if FromUK1 = ToUK2 or FromVK1 = ToVK2. |
1086 | //! |
1087 | //! Raises if FromUK1, ToUK2 are not in the range [FirstUKnotIndex, |
1088 | //! LastUKnotIndex] or if FromVK1, ToVK2 are not in the range |
1089 | //! [FirstVKnotIndex, LastVKnotIndex] |
1090 | Standard_EXPORT gp_Pnt LocalValue (const Standard_Real U, const Standard_Real V, const Standard_Integer FromUK1, const Standard_Integer ToUK2, const Standard_Integer FromVK1, const Standard_Integer ToVK2) const; |
1091 | |
1092 | |
1093 | //! Computes the U isoparametric curve. |
1094 | //! A B-spline curve is returned. |
1095 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const; |
1096 | |
1097 | |
1098 | //! Computes the V isoparametric curve. |
1099 | //! A B-spline curve is returned. |
1100 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const; |
1101 | |
1102 | |
1103 | //! Computes the U isoparametric curve. |
1104 | //! If CheckRational=False, no try to make it non-rational. |
1105 | //! A B-spline curve is returned. |
1106 | Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U, const Standard_Boolean CheckRational) const; |
1107 | |
1108 | |
1109 | //! Computes the V isoparametric curve. |
1110 | //! If CheckRational=False, no try to make it non-rational. |
1111 | //! A B-spline curve is returned. |
1112 | //! transformations |
1113 | Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V, const Standard_Boolean CheckRational) const; |
1114 | |
1115 | //! Applies the transformation T to this BSpline surface. |
1116 | Standard_EXPORT void Transform (const gp_Trsf& T); |
1117 | |
1118 | |
1119 | //! Returns the value of the maximum degree of the normalized |
1120 | //! B-spline basis functions in the u and v directions. |
1121 | Standard_EXPORT static Standard_Integer MaxDegree(); |
1122 | |
1123 | //! Computes two tolerance values for this BSpline |
1124 | //! surface, based on the given tolerance in 3D space |
1125 | //! Tolerance3D. The tolerances computed are: |
1126 | //! - UTolerance in the u parametric direction, and |
1127 | //! - VTolerance in the v parametric direction. |
1128 | //! If f(u,v) is the equation of this BSpline surface, |
1129 | //! UTolerance and VTolerance guarantee that : |
1130 | //! | u1 - u0 | < UTolerance and |
1131 | //! | v1 - v0 | < VTolerance |
1132 | //! ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D |
1133 | Standard_EXPORT void Resolution (const Standard_Real Tolerance3D, Standard_Real& UTolerance, Standard_Real& VTolerance); |
1134 | |
1135 | //! Creates a new object which is a copy of this BSpline surface. |
1136 | Standard_EXPORT Handle(Geom_Geometry) Copy() const; |
1137 | |
1138 | |
1139 | |
1140 | |
1141 | DEFINE_STANDARD_RTTI(Geom_BSplineSurface,Geom_BoundedSurface) |
1142 | |
1143 | protected: |
1144 | |
1145 | |
1146 | |
1147 | |
1148 | private: |
1149 | |
1150 | |
1151 | //! Recompute the flatknots, the knotsdistribution, the |
1152 | //! continuity for U. |
1153 | Standard_EXPORT void UpdateUKnots(); |
1154 | |
1155 | //! Recompute the flatknots, the knotsdistribution, the |
1156 | //! continuity for V. |
1157 | Standard_EXPORT void UpdateVKnots(); |
1158 | |
1159 | Standard_Boolean urational; |
1160 | Standard_Boolean vrational; |
1161 | Standard_Boolean uperiodic; |
1162 | Standard_Boolean vperiodic; |
1163 | GeomAbs_BSplKnotDistribution uknotSet; |
1164 | GeomAbs_BSplKnotDistribution vknotSet; |
1165 | GeomAbs_Shape Usmooth; |
1166 | GeomAbs_Shape Vsmooth; |
1167 | Standard_Integer udeg; |
1168 | Standard_Integer vdeg; |
1169 | Handle(TColgp_HArray2OfPnt) poles; |
1170 | Handle(TColStd_HArray2OfReal) weights; |
1171 | Handle(TColStd_HArray1OfReal) ufknots; |
1172 | Handle(TColStd_HArray1OfReal) vfknots; |
1173 | Handle(TColStd_HArray1OfReal) uknots; |
1174 | Handle(TColStd_HArray1OfReal) vknots; |
1175 | Handle(TColStd_HArray1OfInteger) umults; |
1176 | Handle(TColStd_HArray1OfInteger) vmults; |
1177 | Standard_Real umaxderivinv; |
1178 | Standard_Real vmaxderivinv; |
1179 | Standard_Boolean maxderivinvok; |
1180 | |
1181 | |
1182 | }; |
1183 | |
1184 | |
1185 | |
1186 | |
1187 | |
1188 | |
1189 | |
1190 | #endif // _Geom_BSplineSurface_HeaderFile |