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