0026931: [Regression in 6.9.0] Exporting a face throws an exception
[occt.git] / src / Geom / Geom_BSplineSurface.hxx
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   //! Modifies this surface to be periodic in the U 
237   //! parametric direction.
238   //! To become periodic in a given parametric direction a
239   //! surface must be closed in that parametric direction,
240   //! and the knot sequence relative to that direction must be periodic.
241   //! To generate this periodic sequence of knots, the
242   //! functions FirstUKnotIndex and LastUKnotIndex  are used to
243   //! compute I1 and I2. These are the indexes, in the
244   //! knot array associated with the given parametric
245   //! direction, of the knots that correspond to the first and
246   //! last parameters of this BSpline surface in the given
247   //! parametric direction. Hence the period is:
248   //! Knots(I1) - Knots(I2)
249   //! As a result, the knots and poles tables are modified.
250   //! Exceptions
251   //! Standard_ConstructionError if the surface is not
252   //! closed in the given parametric direction.
253   Standard_EXPORT void SetUPeriodic();
254   
255   //! Sets the surface V periodic.
256   //! Modifies this surface to be periodic in the V
257   //! parametric direction.
258   //! To become periodic in a given parametric direction a
259   //! surface must be closed in that parametric direction,
260   //! and the knot sequence relative to that direction must be periodic.
261   //! To generate this periodic sequence of knots, the
262   //! functions FirstVKnotIndex and LastVKnotIndex are used to
263   //! compute I1 and I2. These are the indexes, in the
264   //! knot array associated with the given parametric
265   //! direction, of the knots that correspond to the first and
266   //! last parameters of this BSpline surface in the given
267   //! parametric direction. Hence the period is:
268   //! Knots(I1) - Knots(I2)
269   //! As a result, the knots and poles tables are modified.
270   //! Exceptions
271   //! Standard_ConstructionError if the surface is not
272   //! closed in the given parametric direction.
273   Standard_EXPORT void SetVPeriodic();
274   
275   //! returns the parameter normalized within
276   //! the period if the surface is periodic : otherwise
277   //! does not do anything
278   Standard_EXPORT void PeriodicNormalization (Standard_Real& U, Standard_Real& V) const;
279   
280   //! Assigns the knot of index Index in the knots table in
281   //! the corresponding parametric direction to be the
282   //! origin of this periodic BSpline surface. As a
283   //! consequence, the knots and poles tables are modified.
284   //! Exceptions
285   //! Standard_NoSuchObject if this BSpline surface is
286   //! not periodic in the given parametric direction.
287   //! Standard_DomainError if Index is outside the
288   //! bounds of the knots table in the given parametric direction.
289   Standard_EXPORT void SetUOrigin (const Standard_Integer Index);
290   
291   //! Assigns the knot of index Index in the knots table in
292   //! the corresponding parametric direction to be the
293   //! origin of this periodic BSpline surface. As a
294   //! consequence, the knots and poles tables are modified.
295   //! Exceptions
296   //! Standard_NoSuchObject if this BSpline surface is
297   //! not periodic in the given parametric direction.
298   //! Standard_DomainError if Index is outside the
299   //! bounds of the knots table in the given parametric direction.
300   Standard_EXPORT void SetVOrigin (const Standard_Integer Index);
301   
302   //! Sets the surface U not periodic.
303   //! Changes this BSpline surface into a non-periodic
304   //! surface along U direction. 
305   //! If this surface is already non-periodic, it is not modified.
306   //! Note: the poles and knots tables are modified.
307   Standard_EXPORT void SetUNotPeriodic();
308   
309   //! Sets the surface V not periodic.
310   //! Changes this BSpline surface into a non-periodic
311   //! surface along V direction. 
312   //! If this surface is already non-periodic, it is not modified.
313   //! Note: the poles and knots tables are modified.
314   Standard_EXPORT void SetVNotPeriodic();
315   
316   //! Changes the orientation of this BSpline surface in the
317   //! U parametric direction. The bounds of the
318   //! surface are not changed but the given parametric
319   //! direction is reversed. Hence the orientation of the
320   //! surface is reversed.
321   //! The knots and poles tables are modified.
322   Standard_EXPORT void UReverse() Standard_OVERRIDE;
323   
324   //! Changes the orientation of this BSpline surface in the
325   //! V parametric direction. The bounds of the
326   //! surface are not changed but the given parametric
327   //! direction is reversed. Hence the orientation of the
328   //! surface is reversed.
329   //! The knots and poles tables are modified.
330   Standard_EXPORT void VReverse() Standard_OVERRIDE;
331   
332   //! Computes the u parameter on the modified
333   //! surface, produced by reversing its U parametric
334   //! direction, for the point of u parameter U,  on this BSpline surface.
335   //! For a BSpline surface, these functions return respectively:
336   //! - UFirst + ULast - U, 
337   //! where UFirst, ULast are
338   //! the values of the first and last parameters of this
339   //! BSpline surface, in the u parametric directions.
340   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
341   
342   //! Computes the v parameter on the modified
343   //! surface, produced by reversing its V parametric
344   //! direction, for the point of v parameter V on this BSpline surface.
345   //! For a BSpline surface, these functions return respectively:
346   //! - VFirst + VLast - V,
347   //! VFirst and VLast are
348   //! the values of the first and last parameters of this
349   //! BSpline surface, in the v pametric directions.
350   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
351   
352   //! Increases the degrees of this BSpline surface to
353   //! UDegree and VDegree in the u and v parametric
354   //! directions respectively. As a result, the tables of poles,
355   //! weights and multiplicities are modified. The tables of
356   //! knots is not changed.
357   //! Note: Nothing is done if the given degree is less than
358   //! or equal to the current degree in the corresponding
359   //! parametric direction.
360   //! Exceptions
361   //! Standard_ConstructionError if UDegree or
362   //! VDegree is greater than
363   //! Geom_BSplineSurface::MaxDegree().
364   Standard_EXPORT void IncreaseDegree (const Standard_Integer UDegree, const Standard_Integer VDegree);
365   
366   //! Inserts into the knots table for the U
367   //! parametric direction of this BSpline surface:
368   //! - the values of the array Knots, with their respective
369   //! multiplicities, Mults.
370   //! If the knot value to insert already exists in the table, its multiplicity is:
371   //! - increased by M, if Add is true (the default), or
372   //! - increased to M, if Add is false.
373   //! The tolerance criterion used to check the equality of
374   //! the knots is the larger of the values ParametricTolerance and
375   //! Standard_Real::Epsilon(val), where val is the knot value to be inserted.
376   //! Warning
377   //! - If a given multiplicity coefficient is null, or negative, nothing is done.
378   //! - The new multiplicity of a knot is limited to the degree of this BSpline surface in the
379   //! corresponding parametric direction.
380   //! Exceptions
381   //! Standard_ConstructionError if a knot value to
382   //! insert is outside the bounds of this BSpline surface in
383   //! the specified parametric direction. The comparison
384   //! uses the precision criterion ParametricTolerance.
385   Standard_EXPORT void InsertUKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True);
386   
387   //! Inserts into the knots table for the V
388   //! parametric direction of this BSpline surface:
389   //! - the values of the array Knots, with their respective
390   //! multiplicities, Mults.
391   //! If the knot value to insert already exists in the table, its multiplicity is:
392   //! - increased by M, if Add is true (the default), or
393   //! - increased to M, if Add is false.
394   //! The tolerance criterion used to check the equality of
395   //! the knots is the larger of the values ParametricTolerance and
396   //! Standard_Real::Epsilon(val), where val is the knot value to be inserted.
397   //! Warning
398   //! - If a given multiplicity coefficient is null, or negative, nothing is done.
399   //! - The new multiplicity of a knot is limited to the degree of this BSpline surface in the
400   //! corresponding parametric direction.
401   //! Exceptions
402   //! Standard_ConstructionError if a knot value to
403   //! insert is outside the bounds of this BSpline surface in
404   //! the specified parametric direction. The comparison
405   //! uses the precision criterion ParametricTolerance.
406   Standard_EXPORT void InsertVKnots (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults, const Standard_Real ParametricTolerance = 0.0, const Standard_Boolean Add = Standard_True);
407   
408   //! Reduces to M the multiplicity of the knot of index
409   //! Index in the U parametric direction. If M is 0, the knot is removed.
410   //! With a modification of this type, the table of poles is also modified.
411   //! Two different algorithms are used systematically to
412   //! compute the new poles of the surface. For each
413   //! pole, the distance between the pole calculated
414   //! using the first algorithm and the same pole
415   //! calculated using the second algorithm, is checked. If
416   //! this distance is less than Tolerance it ensures that
417   //! the surface is not modified by more than Tolerance.
418   //! Under these conditions, the function returns true;
419   //! otherwise, it returns false.
420   //! A low tolerance prevents modification of the
421   //! surface. A high tolerance "smoothes" the surface.
422   //! Exceptions
423   //! Standard_OutOfRange if Index is outside the
424   //! bounds of the knots table of this BSpline surface.
425   Standard_EXPORT Standard_Boolean RemoveUKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance);
426   
427   //! Reduces to M the multiplicity of the knot of index
428   //! Index in the V parametric direction. If M is 0, the knot is removed.
429   //! With a modification of this type, the table of poles is also modified.
430   //! Two different algorithms are used systematically to
431   //! compute the new poles of the surface. For each
432   //! pole, the distance between the pole calculated
433   //! using the first algorithm and the same pole
434   //! calculated using the second algorithm, is checked. If
435   //! this distance is less than Tolerance it ensures that
436   //! the surface is not modified by more than Tolerance.
437   //! Under these conditions, the function returns true;
438   //! otherwise, it returns false.
439   //! A low tolerance prevents modification of the
440   //! surface. A high tolerance "smoothes" the surface.
441   //! Exceptions
442   //! Standard_OutOfRange if Index is outside the
443   //! bounds of the knots table of this BSpline surface.
444   Standard_EXPORT Standard_Boolean RemoveVKnot (const Standard_Integer Index, const Standard_Integer M, const Standard_Real Tolerance);
445   
446
447   //! Increases the multiplicity of the knot of range UIndex
448   //! in the UKnots sequence.
449   //! M is the new multiplicity. M must be greater than the
450   //! previous multiplicity and lower or equal to the degree
451   //! of the surface in the U parametric direction.
452   //! Raised if M is not in the range [1, UDegree]
453   //!
454   //! Raised if UIndex is not in the range [FirstUKnotIndex,
455   //! LastUKnotIndex] given by the methods with the same name.
456   Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer UIndex, const Standard_Integer M);
457   
458
459   //! Increases until order M the multiplicity of the set of knots
460   //! FromI1,...., ToI2 in the U direction. This method can be used
461   //! to make a B_spline surface into a PiecewiseBezier B_spline
462   //! surface.
463   //! If <me> was uniform, it can become non uniform.
464   //!
465   //! Raised if FromI1 or ToI2 is out of the range [FirstUKnotIndex,
466   //! LastUKnotIndex].
467   //!
468   //! M should be greater than the previous multiplicity of the
469   //! all the knots FromI1,..., ToI2 and lower or equal to the
470   //! Degree of the surface in the U parametric direction.
471   Standard_EXPORT void IncreaseUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M);
472   
473
474   //! Increments the multiplicity of the consecutives uknots FromI1..ToI2
475   //! by step.   The multiplicity of each knot FromI1,.....,ToI2 must be
476   //! lower or equal to the UDegree of the B_spline.
477   //!
478   //! Raised if FromI1 or ToI2 is not in the range
479   //! [FirstUKnotIndex, LastUKnotIndex]
480   //!
481   //! Raised if one knot has a multiplicity greater than UDegree.
482   Standard_EXPORT void IncrementUMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step);
483   
484
485   //! Increases the multiplicity of a knot in the V direction.
486   //! M is the new multiplicity.
487   //!
488   //! M should be greater than the previous multiplicity and lower
489   //! than the degree of the surface in the V parametric direction.
490   //!
491   //! Raised if VIndex is not in the range [FirstVKnotIndex,
492   //! LastVKnotIndex] given by the methods with the same name.
493   Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer VIndex, const Standard_Integer M);
494   
495
496   //! Increases until order M the multiplicity of the set of knots
497   //! FromI1,...., ToI2 in the V direction. This method can be used to
498   //! make a BSplineSurface into a PiecewiseBezier B_spline
499   //! surface. If <me> was uniform, it can become non-uniform.
500   //!
501   //! Raised if FromI1 or ToI2 is out of the range [FirstVKnotIndex,
502   //! LastVKnotIndex] given by the methods with the same name.
503   //!
504   //! M should be greater than the previous multiplicity of the
505   //! all the knots FromI1,..., ToI2 and lower or equal to the
506   //! Degree of the surface in the V parametric direction.
507   Standard_EXPORT void IncreaseVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer M);
508   
509
510   //! Increments the multiplicity of the consecutives vknots FromI1..ToI2
511   //! by step.  The multiplicity of each knot FromI1,.....,ToI2 must be
512   //! lower or equal to the VDegree of the B_spline.
513   //!
514   //! Raised if FromI1 or ToI2 is not in the range
515   //! [FirstVKnotIndex, LastVKnotIndex]
516   //!
517   //! Raised if one knot has a multiplicity greater than VDegree.
518   Standard_EXPORT void IncrementVMultiplicity (const Standard_Integer FromI1, const Standard_Integer ToI2, const Standard_Integer Step);
519   
520
521   //! Inserts a knot value in the sequence of UKnots. If U is a knot
522   //! value this method increases the multiplicity of the knot if the
523   //! previous multiplicity was lower than M else it does nothing. The
524   //! tolerance criterion is ParametricTolerance. ParametricTolerance
525   //! should be greater or equal than Resolution from package gp.
526   //!
527   //! Raised if U is out of the bounds [U1, U2] given by the methods
528   //! Bounds, the criterion ParametricTolerance is used.
529   //! Raised if M is not in the range [1, UDegree].
530   Standard_EXPORT void InsertUKnot (const Standard_Real U, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True);
531   
532
533   //! Inserts a knot value in the sequence of VKnots. If V is a knot
534   //! value this method increases the multiplicity of the knot if the
535   //! previous multiplicity was lower than M otherwise it does nothing.
536   //! The tolerance criterion is ParametricTolerance.
537   //! ParametricTolerance should be greater or equal than Resolution
538   //! from package gp.
539   //!
540   //! raises if V is out of the Bounds [V1, V2] given by the methods
541   //! Bounds, the criterion ParametricTolerance is used.
542   //! raises if M is not in the range [1, VDegree].
543   Standard_EXPORT void InsertVKnot (const Standard_Real V, const Standard_Integer M, const Standard_Real ParametricTolerance, const Standard_Boolean Add = Standard_True);
544   
545
546   //! Segments the surface between U1 and U2 in the U-Direction.
547   //! between V1 and V2 in the V-Direction.
548   //! The control points are modified, the first and the last point
549   //! are not the same.
550   //! Warnings :
551   //! Even if <me> is not closed it can become closed after the
552   //! segmentation for example if U1 or U2 are out of the bounds
553   //! of the surface <me> or if the surface makes loop.
554   //! raises if U2 < U1 or V2 < V1.
555   //! Standard_DomainError if U2 - U1 exceeds the uperiod for uperiodic surfaces.
556   //! i.e. ((U2 - U1) - UPeriod) > Precision::PConfusion().
557   //! Standard_DomainError if V2 - V1 exceeds the vperiod for vperiodic surfaces.
558   //! i.e. ((V2 - V1) - VPeriod) > Precision::PConfusion()).
559   Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2);
560   
561
562   //! Segments the surface between U1 and U2 in the U-Direction.
563   //! between V1 and V2 in the V-Direction.
564   //!
565   //! same as Segment but do nothing if U1 and U2 (resp. V1 and V2) are
566   //! equal to the bounds in U (resp. in V) of <me>.
567   //! For example, if <me> is periodic in V, it will be always periodic
568   //! in V after the segmentation if the bounds in V are unchanged
569   //!
570   //! Warnings :
571   //! Even if <me> is not closed it can become closed after the
572   //! segmentation for example if U1 or U2 are out of the bounds
573   //! of the surface <me> or if the surface makes loop.
574   //! raises if U2 < U1 or V2 < V1.
575   //! Standard_DomainError if U2 - U1 exceeds the uperiod for uperiodic surfaces.
576   //! i.e. ((U2 - U1) - UPeriod) > Precision::PConfusion().
577   //! Standard_DomainError if V2 - V1 exceeds the vperiod for vperiodic surfaces.
578   //! i.e. ((V2 - V1) - VPeriod) > Precision::PConfusion()).
579   Standard_EXPORT void CheckAndSegment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2);
580   
581   //! Substitutes the UKnots of range UIndex with K.
582   //!
583   //! Raised if UIndex < 1 or UIndex > NbUKnots
584   //!
585   //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
586   Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K);
587   
588   //! Changes all the U-knots of the surface.
589   //! The multiplicity of the knots are not modified.
590   //!
591   //! Raised if there is an index such that UK (Index+1) <= UK (Index).
592   //!
593   //! Raised if  UK.Lower() < 1 or UK.Upper() > NbUKnots
594   Standard_EXPORT void SetUKnots (const TColStd_Array1OfReal& UK);
595   
596
597   //! Changes the value of the UKnots of range UIndex and
598   //! increases its multiplicity.
599   //!
600   //! Raised if UIndex is not in the range [FirstUKnotIndex,
601   //! LastUKnotIndex] given by the methods with the same name.
602   //!
603   //! Raised if K >= UKnots(UIndex+1) or K <= UKnots(UIndex-1)
604   //! M must be lower than UDegree and greater than the previous
605   //! multiplicity of the knot of range UIndex.
606   Standard_EXPORT void SetUKnot (const Standard_Integer UIndex, const Standard_Real K, const Standard_Integer M);
607   
608   //! Substitutes the VKnots of range VIndex with K.
609   //!
610   //! Raised if VIndex < 1 or VIndex > NbVKnots
611   //!
612   //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
613   Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K);
614   
615   //! Changes all the V-knots of the surface.
616   //! The multiplicity of the knots are not modified.
617   //!
618   //! Raised if there is an index such that VK (Index+1) <= VK (Index).
619   //!
620   //! Raised if  VK.Lower() < 1 or VK.Upper() > NbVKnots
621   Standard_EXPORT void SetVKnots (const TColStd_Array1OfReal& VK);
622   
623
624   //! Changes the value of the VKnots of range VIndex and increases
625   //! its multiplicity.
626   //!
627   //! Raised if VIndex is not in the range [FirstVKnotIndex,
628   //! LastVKnotIndex] given by the methods with the same name.
629   //!
630   //! Raised if K >= VKnots(VIndex+1) or K <= VKnots(VIndex-1)
631   //! M must be lower than VDegree and greater than the previous
632   //! multiplicity of the knot of range VIndex.
633   Standard_EXPORT void SetVKnot (const Standard_Integer VIndex, const Standard_Real K, const Standard_Integer M);
634   
635
636   //! Locates the parametric value U in the sequence of UKnots.
637   //! If "WithKnotRepetition" is True we consider the knot's
638   //! representation with repetition of multiple knot value,
639   //! otherwise  we consider the knot's representation with
640   //! no repetition of multiple knot values.
641   //! UKnots (I1) <= U <= UKnots (I2)
642   //! . if I1 = I2  U is a knot value (the tolerance criterion
643   //! ParametricTolerance is used).
644   //! . if I1 < 1  => U < UKnots(1) - Abs(ParametricTolerance)
645   //! . if I2 > NbUKnots => U > UKnots(NbUKnots)+Abs(ParametricTolerance)
646   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;
647   
648
649   //! Locates the parametric value V in the sequence of knots.
650   //! If "WithKnotRepetition" is True we consider the knot's
651   //! representation with repetition of multiple knot value,
652   //! otherwise  we consider the knot's representation with
653   //! no repetition of multiple knot values.
654   //! VKnots (I1) <= V <= VKnots (I2)
655   //! . if I1 = I2  V is a knot value (the tolerance criterion
656   //! ParametricTolerance is used).
657   //! . if I1 < 1  => V < VKnots(1) - Abs(ParametricTolerance)
658   //! . if I2 > NbVKnots => V > VKnots(NbVKnots)+Abs(ParametricTolerance)
659   //! poles insertion and removing
660   //! The following methods are available only if the surface
661   //! is Uniform or QuasiUniform in the considered direction
662   //! The knot repartition is modified.
663   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;
664   
665
666   //! Substitutes the pole of range (UIndex, VIndex) with P.
667   //! If the surface is rational the weight of range (UIndex, VIndex)
668   //! is not modified.
669   //!
670   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
671   //! VIndex > NbVPoles.
672   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P);
673   
674
675   //! Substitutes the pole and the weight of range (UIndex, VIndex)
676   //! with P and W.
677   //!
678   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
679   //! VIndex > NbVPoles.
680   //! Raised if Weight <= Resolution from package gp.
681   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P, const Standard_Real Weight);
682   
683
684   //! Changes a column of poles or a part of this column.
685   //! Raised if Vindex < 1 or VIndex > NbVPoles.
686   //!
687   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles.
688   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
689   
690
691   //! Changes a column of poles or a part of this column with the
692   //! corresponding weights. If the surface was rational it can
693   //! become non rational. If the surface was non rational it can
694   //! become rational.
695   //! Raised if Vindex < 1 or VIndex > NbVPoles.
696   //!
697   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
698   //! Raised if the bounds of CPoleWeights are not the same as the
699   //! bounds of CPoles.
700   //! Raised if one of the weight value of CPoleWeights is lower or
701   //! equal to Resolution from package gp.
702   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
703   
704
705   //! Changes a row of poles or a part of this row with the
706   //! corresponding weights. If the surface was rational it can
707   //! become non rational. If the surface was non rational it can
708   //! become rational.
709   //! Raised if Uindex < 1 or UIndex > NbUPoles.
710   //!
711   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
712   //! raises if the bounds of CPoleWeights are not the same as the
713   //! bounds of CPoles.
714   //! Raised if one of the weight value of CPoleWeights is lower or
715   //! equal to Resolution from package gp.
716   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
717   
718
719   //! Changes a row of poles or a part of this row.
720   //! Raised if Uindex < 1 or UIndex > NbUPoles.
721   //!
722   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles.
723   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
724   
725
726   //! Changes the weight of the pole of range UIndex, VIndex.
727   //! If the surface was non rational it can become rational.
728   //! If the surface was rational it can become non rational.
729   //!
730   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
731   //! VIndex > NbVPoles
732   //!
733   //! Raised if weight is lower or equal to Resolution from
734   //! package gp
735   Standard_EXPORT void SetWeight (const Standard_Integer UIndex, const Standard_Integer VIndex, const Standard_Real Weight);
736   
737
738   //! Changes a column of weights of a part of this column.
739   //!
740   //! Raised if VIndex < 1 or VIndex > NbVPoles
741   //!
742   //! Raised if CPoleWeights.Lower() < 1 or
743   //! CPoleWeights.Upper() > NbUPoles.
744   //! Raised if a weight value is lower or equal to Resolution
745   //! from package gp.
746   Standard_EXPORT void SetWeightCol (const Standard_Integer VIndex, const TColStd_Array1OfReal& CPoleWeights);
747   
748
749   //! Changes a row of weights or a part of this row.
750   //!
751   //! Raised if UIndex < 1 or UIndex > NbUPoles
752   //!
753   //! Raised if CPoleWeights.Lower() < 1 or
754   //! CPoleWeights.Upper() > NbVPoles.
755   //! Raised  if a weight value is lower or equal to Resolution
756   //! from package gp.
757   Standard_EXPORT void SetWeightRow (const Standard_Integer UIndex, const TColStd_Array1OfReal& CPoleWeights);
758   
759   //! Move a point with parameter U and V to P.
760   //! given u,v  as parameters)  to  reach a  new position
761   //! UIndex1, UIndex2, VIndex1, VIndex2:
762   //! indicates the poles which can be moved
763   //! if Problem in BSplineBasis calculation, no change
764   //! for the curve and
765   //! UFirstIndex, VLastIndex = 0
766   //! VFirstIndex, VLastIndex = 0
767   //!
768   //! Raised if UIndex1 < UIndex2 or VIndex1 < VIndex2 or
769   //! UIndex1 < 1 || UIndex1 > NbUPoles or
770   //! UIndex2 < 1 || UIndex2 > NbUPoles
771   //! VIndex1 < 1 || VIndex1 > NbVPoles or
772   //! VIndex2 < 1 || VIndex2 > NbVPoles
773   //! characteristics of the surface
774   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);
775   
776
777   //! Returns true if the first control points row and the last
778   //! control points row are identical. The tolerance criterion
779   //! is Resolution from package gp.
780   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
781   
782
783   //! Returns true if the first control points column and the
784   //! last last control points column are identical.
785   //! The tolerance criterion is Resolution from package gp.
786   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
787   
788
789   //! Returns True if the order of continuity of the surface in the
790   //! U direction  is N.
791   //! Raised if N < 0.
792   Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
793   
794
795   //! Returns True if the order of continuity of the surface
796   //! in the V direction  is N.
797   //! Raised if N < 0.
798   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
799   
800
801   //! Returns True if the surface is closed in the U direction
802   //! and if the B-spline has been turned into a periodic surface
803   //! using the function SetUPeriodic.
804   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
805   
806
807   //! Returns False if for each row of weights all the weights
808   //! are identical.
809   //! The tolerance criterion is resolution from package gp.
810   //! Example :
811   //! |1.0, 1.0, 1.0|
812   //! if Weights =  |0.5, 0.5, 0.5|   returns False
813   //! |2.0, 2.0, 2.0|
814   Standard_EXPORT Standard_Boolean IsURational() const;
815   
816
817   //! Returns True if the surface is closed in the V direction
818   //! and if the B-spline has been turned into a periodic
819   //! surface using the function SetVPeriodic.
820   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
821   
822
823   //! Returns False if for each column of weights all the weights
824   //! are identical.
825   //! The tolerance criterion is resolution from package gp.
826   //! Examples :
827   //! |1.0, 2.0, 0.5|
828   //! if Weights =  |1.0, 2.0, 0.5|   returns False
829   //! |1.0, 2.0, 0.5|
830   Standard_EXPORT Standard_Boolean IsVRational() const;
831   
832
833   //! Returns the parametric bounds of the surface.
834   //! Warnings :
835   //! These parametric values are the bounds of the array of
836   //! knots UKnots and VKnots only if the first knots and the
837   //! last knots have a multiplicity equal to UDegree + 1 or
838   //! VDegree + 1
839   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
840   
841
842   //! Returns the continuity of the surface :
843   //! C0 : only geometric continuity,
844   //! C1 : continuity of the first derivative all along the Surface,
845   //! C2 : continuity of the second derivative all along the Surface,
846   //! C3 : continuity of the third derivative all along the Surface,
847   //! CN : the order of continuity is infinite.
848   //! A B-spline surface is infinitely continuously differentiable
849   //! for the couple of parameters U, V such thats U != UKnots(i)
850   //! and V != VKnots(i). The continuity of the surface at a knot
851   //! value depends on the multiplicity of this knot.
852   //! Example :
853   //! If the surface is C1 in the V direction and C2 in the U
854   //! direction this function returns Shape = C1.
855   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
856   
857
858   //! Computes the Index of the UKnots which gives the first
859   //! parametric value of the surface in the U direction.
860   //! The UIso curve corresponding to this value is a
861   //! boundary curve of the surface.
862   Standard_EXPORT Standard_Integer FirstUKnotIndex() const;
863   
864
865   //! Computes the Index of the VKnots which gives the
866   //! first parametric value of the surface in the V direction.
867   //! The VIso curve corresponding to this knot is a boundary
868   //! curve of the surface.
869   Standard_EXPORT Standard_Integer FirstVKnotIndex() const;
870   
871
872   //! Computes the Index of the UKnots which gives the
873   //! last parametric value of the surface in the U direction.
874   //! The UIso curve corresponding to this knot is a boundary
875   //! curve of the surface.
876   Standard_EXPORT Standard_Integer LastUKnotIndex() const;
877   
878
879   //! Computes the Index of the VKnots which gives the
880   //! last parametric value of the surface in the V direction.
881   //! The VIso curve corresponding to this knot is a
882   //! boundary curve of the surface.
883   Standard_EXPORT Standard_Integer LastVKnotIndex() const;
884   
885   //! Returns the number of knots in the U direction.
886   Standard_EXPORT Standard_Integer NbUKnots() const;
887   
888   //! Returns number of poles in the U direction.
889   Standard_EXPORT Standard_Integer NbUPoles() const;
890   
891   //! Returns the number of knots in the V direction.
892   Standard_EXPORT Standard_Integer NbVKnots() const;
893   
894   //! Returns the number of poles in the V direction.
895   Standard_EXPORT Standard_Integer NbVPoles() const;
896   
897
898   //! Returns the pole of range (UIndex, VIndex).
899   //!
900   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1 or
901   //! VIndex > NbVPoles.
902   Standard_EXPORT gp_Pnt Pole (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
903   
904   //! Returns the poles of the B-spline surface.
905   //!
906   //! Raised if the length of P in the U and V direction
907   //! is not equal to NbUpoles and NbVPoles.
908   Standard_EXPORT void Poles (TColgp_Array2OfPnt& P) const;
909   
910   //! Returns the poles of the B-spline surface.
911   Standard_EXPORT const TColgp_Array2OfPnt& Poles() const;
912   
913
914   //! Returns the degree of the normalized B-splines Ni,n in the U
915   //! direction.
916   Standard_EXPORT Standard_Integer UDegree() const;
917   
918
919   //! Returns the Knot value of range UIndex.
920   //! Raised if UIndex < 1 or UIndex > NbUKnots
921   Standard_EXPORT Standard_Real UKnot (const Standard_Integer UIndex) const;
922   
923
924   //! Returns NonUniform or Uniform or QuasiUniform or
925   //! PiecewiseBezier.  If all the knots differ by a
926   //! positive constant from the preceding knot in the U
927   //! direction the 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 U direction
936   //! The tolerance criterion is Resolution from package gp.
937   Standard_EXPORT GeomAbs_BSplKnotDistribution UKnotDistribution() const;
938   
939   //! Returns the knots in the U direction.
940   //!
941   //! Raised if the length of Ku is not equal to the number of knots
942   //! in the U direction.
943   Standard_EXPORT void UKnots (TColStd_Array1OfReal& Ku) const;
944   
945   //! Returns the knots in the U direction.
946   Standard_EXPORT const TColStd_Array1OfReal& UKnots() const;
947   
948   //! Returns the uknots sequence.
949   //! In this sequence the knots with a multiplicity greater than 1
950   //! are repeated.
951   //! Example :
952   //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
953   //!
954   //! Raised if the length of Ku is not equal to NbUPoles + UDegree + 1
955   Standard_EXPORT void UKnotSequence (TColStd_Array1OfReal& Ku) const;
956   
957   //! Returns the uknots 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& UKnotSequence() const;
963   
964
965   //! Returns the multiplicity value of knot of range UIndex in
966   //! the u direction.
967   //! Raised if UIndex < 1 or UIndex > NbUKnots.
968   Standard_EXPORT Standard_Integer UMultiplicity (const Standard_Integer UIndex) const;
969   
970
971   //! Returns the multiplicities of the knots in the U direction.
972   //!
973   //! Raised if the length of Mu is not equal to the number of
974   //! knots in the U direction.
975   Standard_EXPORT void UMultiplicities (TColStd_Array1OfInteger& Mu) const;
976   
977   //! Returns the multiplicities of the knots in the U direction.
978   Standard_EXPORT const TColStd_Array1OfInteger& UMultiplicities() const;
979   
980
981   //! Returns the degree of the normalized B-splines Ni,d in the
982   //! V direction.
983   Standard_EXPORT Standard_Integer VDegree() const;
984   
985   //! Returns the Knot value of range VIndex.
986   //! Raised if VIndex < 1 or VIndex > NbVKnots
987   Standard_EXPORT Standard_Real VKnot (const Standard_Integer VIndex) const;
988   
989
990   //! Returns NonUniform or Uniform or QuasiUniform or
991   //! PiecewiseBezier. If all the knots differ by a positive
992   //! constant from the preceding knot in the V direction the
993   //! B-spline surface can be :
994   //! - Uniform if all the knots are of multiplicity 1,
995   //! - QuasiUniform if all the knots are of multiplicity 1
996   //! except for the first and last knot which are of
997   //! multiplicity Degree + 1,
998   //! - PiecewiseBezier if the first and last knots have
999   //! multiplicity  Degree + 1 and if interior knots have
1000   //! multiplicity Degree
1001   //! otherwise the surface is non uniform in the V direction.
1002   //! The tolerance criterion is Resolution from package gp.
1003   Standard_EXPORT GeomAbs_BSplKnotDistribution VKnotDistribution() const;
1004   
1005   //! Returns the knots in the V direction.
1006   //!
1007   //! Raised if the length of Kv is not equal to the number of
1008   //! knots in the V direction.
1009   Standard_EXPORT void VKnots (TColStd_Array1OfReal& Kv) const;
1010   
1011   //! Returns the knots in the V direction.
1012   Standard_EXPORT const TColStd_Array1OfReal& VKnots() const;
1013   
1014   //! Returns the vknots sequence.
1015   //! In this sequence the knots with a multiplicity greater than 1
1016   //! are repeated.
1017   //! Example :
1018   //! Kv = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1019   //!
1020   //! Raised if the length of Kv is not equal to NbVPoles + VDegree + 1
1021   Standard_EXPORT void VKnotSequence (TColStd_Array1OfReal& Kv) const;
1022   
1023   //! Returns the vknots sequence.
1024   //! In this sequence the knots with a multiplicity greater than 1
1025   //! are repeated.
1026   //! Example :
1027   //! Ku = {k1, k1, k1, k2, k3, k3, k4, k4, k4}
1028   Standard_EXPORT const TColStd_Array1OfReal& VKnotSequence() const;
1029   
1030
1031   //! Returns the multiplicity value of knot of range VIndex in
1032   //! the v direction.
1033   //! Raised if VIndex < 1 or VIndex > NbVKnots
1034   Standard_EXPORT Standard_Integer VMultiplicity (const Standard_Integer VIndex) const;
1035   
1036
1037   //! Returns the multiplicities of the knots in the V direction.
1038   //!
1039   //! Raised if the length of Mv is not equal to the number of
1040   //! knots in the V direction.
1041   Standard_EXPORT void VMultiplicities (TColStd_Array1OfInteger& Mv) const;
1042   
1043   //! Returns the multiplicities of the knots in the V direction.
1044   Standard_EXPORT const TColStd_Array1OfInteger& VMultiplicities() const;
1045   
1046   //! Returns the weight value of range UIndex, VIndex.
1047   //!
1048   //! Raised if UIndex < 1 or UIndex > NbUPoles or VIndex < 1
1049   //! or VIndex > NbVPoles.
1050   Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
1051   
1052   //! Returns the weights of the B-spline surface.
1053   //!
1054   //! Raised if the length of W in the U and V direction is
1055   //! not equal to NbUPoles and NbVPoles.
1056   Standard_EXPORT void Weights (TColStd_Array2OfReal& W) const;
1057   
1058   //! Returns the weights of the B-spline surface.
1059   //! value and derivatives computation
1060   Standard_EXPORT const TColStd_Array2OfReal* Weights() const;
1061   
1062   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
1063   
1064   //! Raised if the continuity of the surface is not C1.
1065   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
1066   
1067   //! Raised if the continuity of the surface is not C2.
1068   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 Standard_OVERRIDE;
1069   
1070   //! Raised if the continuity of the surface is not C3.
1071   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 Standard_OVERRIDE;
1072   
1073
1074   //! Nu is the order of derivation in the U parametric direction and
1075   //! Nv is the order of derivation in the V parametric direction.
1076   //!
1077   //! Raised if the continuity of the surface is not CNu in the U
1078   //! direction and CNv in the V direction.
1079   //!
1080   //! Raised if Nu + Nv < 1 or Nu < 0 or Nv < 0.
1081   //!
1082   //! The following functions computes the point for the
1083   //! parametric values (U, V) and the derivatives at
1084   //! this point on the B-spline surface patch delimited
1085   //! with the knots FromUK1, FromVK1 and the knots ToUK2,
1086   //! ToVK2.  (U, V) can be out of these parametric bounds
1087   //! but for the computation we only use the definition
1088   //! of the surface between these knots. This method is
1089   //! useful to compute local derivative, if the order of
1090   //! continuity of the whole surface is not greater enough.
1091   //! Inside the parametric knot's domain previously defined
1092   //! the evaluations are the same as if we consider the whole
1093   //! definition of the surface. Of course the evaluations are
1094   //! different outside this parametric domain.
1095   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
1096   
1097   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1098   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;
1099   
1100
1101   //! Raised if the local continuity of the surface is not C1
1102   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1103   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1104   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;
1105   
1106
1107   //! Raised if the local continuity of the surface is not C2
1108   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1109   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1110   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;
1111   
1112
1113   //! Raised if the local continuity of the surface is not C3
1114   //! between the knots FromUK1, ToUK2 and FromVK1, ToVK2.
1115   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1116   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;
1117   
1118
1119   //! Raised if the local continuity of the surface is not CNu
1120   //! between the knots FromUK1, ToUK2 and CNv between the knots
1121   //! FromVK1, ToVK2.
1122   //! Raised if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1123   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;
1124   
1125
1126   //! Computes the point of parameter U, V on the BSpline surface patch
1127   //! defines between the knots UK1 UK2, VK1, VK2. U can be out of the
1128   //! bounds [Knot UK1, Knot UK2] and V can be outof the bounds
1129   //! [Knot VK1, Knot VK2]  but for the computation we only use the
1130   //! definition of the surface between these knot values.
1131   //! Raises if FromUK1 = ToUK2 or FromVK1 = ToVK2.
1132   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;
1133   
1134
1135   //! Computes the U isoparametric curve.
1136   //! A B-spline curve is returned.
1137   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
1138   
1139
1140   //! Computes the V isoparametric curve.
1141   //! A B-spline curve is returned.
1142   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
1143   
1144
1145   //! Computes the U isoparametric curve.
1146   //! If CheckRational=False, no try to make it non-rational.
1147   //! A B-spline curve is returned.
1148   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U, const Standard_Boolean CheckRational) const;
1149   
1150
1151   //! Computes the V isoparametric curve.
1152   //! If CheckRational=False, no try to make it non-rational.
1153   //! A B-spline curve is returned.
1154   //! transformations
1155   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V, const Standard_Boolean CheckRational) const;
1156   
1157   //! Applies the transformation T to this BSpline surface.
1158   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
1159   
1160
1161   //! Returns the value of the maximum degree of the normalized
1162   //! B-spline basis functions in the u and v directions.
1163   Standard_EXPORT static Standard_Integer MaxDegree();
1164   
1165   //! Computes two tolerance values for this BSpline
1166   //! surface, based on the given tolerance in 3D space
1167   //! Tolerance3D. The tolerances computed are:
1168   //! - UTolerance in the u parametric direction, and
1169   //! - VTolerance in the v parametric direction.
1170   //! If f(u,v) is the equation of this BSpline surface,
1171   //! UTolerance and VTolerance guarantee that :
1172   //! | u1 - u0 | < UTolerance and
1173   //! | v1 - v0 | < VTolerance
1174   //! ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D
1175   Standard_EXPORT void Resolution (const Standard_Real Tolerance3D, Standard_Real& UTolerance, Standard_Real& VTolerance);
1176   
1177   //! Creates a new object which is a copy of this BSpline surface.
1178   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
1179
1180
1181
1182
1183   DEFINE_STANDARD_RTTIEXT(Geom_BSplineSurface,Geom_BoundedSurface)
1184
1185 protected:
1186
1187
1188
1189
1190 private:
1191
1192   
1193   //! Recompute  the  flatknots,  the knotsdistribution, the
1194   //! continuity for U.
1195   Standard_EXPORT void UpdateUKnots();
1196   
1197   //! Recompute  the  flatknots,  the knotsdistribution, the
1198   //! continuity for V.
1199   Standard_EXPORT void UpdateVKnots();
1200
1201   Standard_Boolean urational;
1202   Standard_Boolean vrational;
1203   Standard_Boolean uperiodic;
1204   Standard_Boolean vperiodic;
1205   GeomAbs_BSplKnotDistribution uknotSet;
1206   GeomAbs_BSplKnotDistribution vknotSet;
1207   GeomAbs_Shape Usmooth;
1208   GeomAbs_Shape Vsmooth;
1209   Standard_Integer udeg;
1210   Standard_Integer vdeg;
1211   Handle(TColgp_HArray2OfPnt) poles;
1212   Handle(TColStd_HArray2OfReal) weights;
1213   Handle(TColStd_HArray1OfReal) ufknots;
1214   Handle(TColStd_HArray1OfReal) vfknots;
1215   Handle(TColStd_HArray1OfReal) uknots;
1216   Handle(TColStd_HArray1OfReal) vknots;
1217   Handle(TColStd_HArray1OfInteger) umults;
1218   Handle(TColStd_HArray1OfInteger) vmults;
1219   Standard_Real umaxderivinv;
1220   Standard_Real vmaxderivinv;
1221   Standard_Boolean maxderivinvok;
1222
1223
1224 };
1225
1226
1227
1228
1229
1230
1231
1232 #endif // _Geom_BSplineSurface_HeaderFile