351121e09db572a2e0bbb563011a618d229a6aeb
[occt.git] / src / Geom / Geom_BezierSurface.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_BezierSurface_HeaderFile
18 #define _Geom_BezierSurface_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Boolean.hxx>
24 #include <TColgp_HArray2OfPnt.hxx>
25 #include <TColStd_HArray2OfReal.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Geom_BoundedSurface.hxx>
29 #include <TColgp_Array2OfPnt.hxx>
30 #include <TColStd_Array2OfReal.hxx>
31 #include <TColgp_Array1OfPnt.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33 #include <GeomAbs_Shape.hxx>
34 #include <BSplSLib.hxx>
35
36 class Standard_ConstructionError;
37 class Standard_DimensionError;
38 class Standard_RangeError;
39 class Standard_OutOfRange;
40 class gp_Pnt;
41 class gp_Vec;
42 class Geom_Curve;
43 class gp_Trsf;
44 class Geom_Geometry;
45
46
47 class Geom_BezierSurface;
48 DEFINE_STANDARD_HANDLE(Geom_BezierSurface, Geom_BoundedSurface)
49
50 //! Describes a rational or non-rational Bezier surface.
51 //! - A non-rational Bezier surface is defined by a table
52 //! of poles (also known as control points).
53 //! - A rational Bezier surface is defined by a table of
54 //! poles with varying associated weights.
55 //! This data is manipulated using two associative 2D arrays:
56 //! - the poles table, which is a 2D array of gp_Pnt, and
57 //! - the weights table, which is a 2D array of reals.
58 //! The bounds of these arrays are:
59 //! - 1 and NbUPoles for the row bounds, where
60 //! NbUPoles is the number of poles of the surface
61 //! in the u parametric direction, and
62 //! - 1 and NbVPoles for the column bounds, where
63 //! NbVPoles is the number of poles of the surface
64 //! in the v parametric direction.
65 //! The poles of the surface, the "control points", are the
66 //! points used to shape and reshape the surface. They
67 //! comprise a rectangular network of points:
68 //! - The points (1, 1), (NbUPoles, 1), (1,
69 //! NbVPoles) and (NbUPoles, NbVPoles)
70 //! are the four parametric "corners" of the surface.
71 //! - The first column of poles and the last column of
72 //! poles define two Bezier curves which delimit the
73 //! surface in the v parametric direction. These are
74 //! the v isoparametric curves corresponding to
75 //! values 0 and 1 of the v parameter.
76 //! - The first row of poles and the last row of poles
77 //! define two Bezier curves which delimit the surface
78 //! in the u parametric direction. These are the u
79 //! isoparametric curves corresponding to values 0
80 //! and 1 of the u parameter.
81 //! It is more difficult to define a geometrical significance
82 //! for the weights. However they are useful for
83 //! representing a quadric surface precisely. Moreover, if
84 //! the weights of all the poles are equal, the surface has
85 //! a polynomial equation, and hence is a "non-rational surface".
86 //! The non-rational surface is a special, but frequently
87 //! used, case, where all poles have identical weights.
88 //! The weights are defined and used only in the case of
89 //! a rational surface. This rational characteristic is
90 //! defined in each parametric direction. Hence, a
91 //! surface can be rational in the u parametric direction,
92 //! and non-rational in the v parametric direction.
93 //! Likewise, the degree of a surface is defined in each
94 //! parametric direction. The degree of a Bezier surface
95 //! in a given parametric direction is equal to the number
96 //! of poles of the surface in that parametric direction,
97 //! minus 1. This must be greater than or equal to 1.
98 //! However, the degree for a Geom_BezierSurface is
99 //! limited to a value of (25) which is defined and
100 //! controlled by the system. This value is returned by the
101 //! function MaxDegree.
102 //! The parameter range for a Bezier surface is [ 0, 1 ]
103 //! in the two parametric directions.
104 //! A Bezier surface can also be closed, or open, in each
105 //! parametric direction. If the first row of poles is
106 //! identical to the last row of poles, the surface is closed
107 //! in the u parametric direction. If the first column of
108 //! poles is identical to the last column of poles, the
109 //! surface is closed in the v parametric direction.
110 //! The continuity of a Bezier surface is infinite in the u
111 //! parametric direction and the in v parametric direction.
112 //! Note: It is not possible to build a Bezier surface with
113 //! negative weights. Any weight value that is less than,
114 //! or equal to, gp::Resolution() is considered
115 //! to be zero. Two weight values, W1 and W2, are
116 //! considered equal if: |W2-W1| <= gp::Resolution()
117 class Geom_BezierSurface : public Geom_BoundedSurface
118 {
119
120 public:
121
122   
123
124   //! Creates a non-rational Bezier surface with a set of poles.
125   //! Control points representation :
126   //! SPoles(Uorigin,Vorigin) ...................SPoles(Uorigin,Vend)
127   //! .                                     .
128   //! .                                     .
129   //! SPoles(Uend, Vorigin) .....................SPoles(Uend, Vend)
130   //! For the double array the row indice corresponds to the parametric
131   //! U direction and the columns indice corresponds to the parametric
132   //! V direction.
133   //! The weights are defaulted to all being 1.
134   //!
135   //! Raised if the number of poles of the surface is lower than 2
136   //! or greater than MaxDegree + 1 in one of the two directions
137   //! U or V.
138   Standard_EXPORT Geom_BezierSurface(const TColgp_Array2OfPnt& SurfacePoles);
139   
140   //! ---Purpose
141   //! Creates a rational Bezier surface with a set of poles and a
142   //! set of weights.
143   //! For the double array the row indice corresponds to the parametric
144   //! U direction and the columns indice corresponds to the parametric
145   //! V direction.
146   //! If all the weights are identical the surface is considered as
147   //! non-rational (the tolerance criterion is Resolution from package
148   //! gp).
149   //!
150   //! Raised if SurfacePoles and PoleWeights have not the same
151   //! Rowlength or have not the same ColLength.
152   //! Raised if PoleWeights (i, j) <= Resolution from gp;
153   //! Raised if the number of poles of the surface is lower than 2
154   //! or greater than MaxDegree + 1 in one of the two directions U or V.
155   Standard_EXPORT Geom_BezierSurface(const TColgp_Array2OfPnt& SurfacePoles, const TColStd_Array2OfReal& PoleWeights);
156   
157   //! Exchanges the direction U and V on a Bezier surface
158   //! As a consequence:
159   //! - the poles and weights tables are transposed,
160   //! - degrees, rational characteristics and so on are
161   //! exchanged between the two parametric directions, and
162   //! - the orientation of the surface is reversed.
163   Standard_EXPORT void ExchangeUV();
164   
165   //! Increases the degree of this Bezier surface in the two parametric directions.
166   //!
167   //! Raised if UDegree < UDegree <me>  or VDegree < VDegree <me>
168   //! Raised if the degree of the surface is greater than MaxDegree
169   //! in one of the two directions U or V.
170   Standard_EXPORT void Increase (const Standard_Integer UDeg, const Standard_Integer VDeg);
171   
172
173   //! Inserts a column of poles. If the surface is rational the weights
174   //! values associated with CPoles are equal defaulted to 1.
175   //!
176   //! Raised if Vindex < 1 or VIndex > NbVPoles.
177   //!
178   //! raises if VDegree is greater than MaxDegree.
179   //! raises if the Length of CPoles is not equal to NbUPoles
180   Standard_EXPORT void InsertPoleColAfter (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
181   
182
183   //! Inserts a column of poles and weights.
184   //! If the surface was non-rational it can become rational.
185   //!
186   //! Raised if Vindex < 1 or VIndex > NbVPoles.
187   //! Raised if
188   //! . VDegree is greater than MaxDegree.
189   //! . the Length of CPoles is not equal to NbUPoles
190   //! . a weight value is lower or equal to Resolution from
191   //! package gp
192   Standard_EXPORT void InsertPoleColAfter (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
193   
194
195   //! Inserts a column of poles. If the surface is rational the weights
196   //! values associated with CPoles are equal defaulted to 1.
197   //!
198   //! Raised if Vindex < 1 or VIndex > NbVPoles.
199   //!
200   //! Raised if VDegree is greater than MaxDegree.
201   //! Raised if the Length of CPoles is not equal to NbUPoles
202   Standard_EXPORT void InsertPoleColBefore (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
203   
204
205   //! Inserts a column of poles and weights.
206   //! If the surface was non-rational it can become rational.
207   //!
208   //! Raised if Vindex < 1 or VIndex > NbVPoles.
209   //! Raised if :
210   //! . VDegree is greater than MaxDegree.
211   //! . the Length of CPoles is not equal to NbUPoles
212   //! . a weight value is lower or equal to Resolution from
213   //! package gp
214   Standard_EXPORT void InsertPoleColBefore (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
215   
216
217   //! Inserts a row of poles. If the surface is rational the weights
218   //! values associated with CPoles are equal defaulted to 1.
219   //!
220   //! Raised if Uindex < 1 or UIndex > NbUPoles.
221   //!
222   //! Raised if UDegree is greater than MaxDegree.
223   //! Raised if the Length of CPoles is not equal to NbVPoles
224   Standard_EXPORT void InsertPoleRowAfter (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
225   
226
227   //! Inserts a row of poles and weights.
228   //! If the surface was non-rational it can become rational.
229   //!
230   //! Raised if Uindex < 1 or UIndex > NbUPoles.
231   //! Raised if :
232   //! . UDegree is greater than MaxDegree.
233   //! . the Length of CPoles is not equal to NbVPoles
234   //! . a weight value is lower or equal to Resolution from
235   //! package gp
236   Standard_EXPORT void InsertPoleRowAfter (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
237   
238
239   //! Inserts a row of poles. If the surface is rational the weights
240   //! values associated with CPoles are equal defaulted to 1.
241   //!
242   //! Raised if Uindex < 1 or UIndex > NbUPoles.
243   //!
244   //! Raised if UDegree is greater than MaxDegree.
245   //! Raised if the Length of CPoles is not equal to NbVPoles
246   Standard_EXPORT void InsertPoleRowBefore (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
247   
248
249   //! Inserts a row of poles and weights.
250   //! If the surface was non-rational it can become rational.
251   //!
252   //! Raised if Uindex < 1 or UIndex > NbUPoles.
253   //! Raised if :
254   //! . UDegree is greater than MaxDegree.
255   //! . the Length of CPoles is not equal to NbVPoles
256   //! . a weight value is lower or equal to Resolution from
257   //! pacakage gp
258   Standard_EXPORT void InsertPoleRowBefore (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
259   
260   //! Removes a column of poles.
261   //! If the surface was rational it can become non-rational.
262   //!
263   //! Raised if NbVPoles <= 2 after removing, a Bezier surface
264   //! must have at least two columns of poles.
265   //! Raised if Vindex < 1 or VIndex > NbVPoles
266   Standard_EXPORT void RemovePoleCol (const Standard_Integer VIndex);
267   
268   //! Removes a row of poles.
269   //! If the surface was rational it can become non-rational.
270   //!
271   //! Raised if NbUPoles <= 2 after removing, a Bezier surface
272   //! must have at least two rows of poles.
273   //! Raised if Uindex < 1 or UIndex > NbUPoles
274   Standard_EXPORT void RemovePoleRow (const Standard_Integer UIndex);
275   
276   //! Modifies this Bezier surface by segmenting it
277   //! between U1 and U2 in the u parametric direction,
278   //! and between V1 and V2 in the v parametric
279   //! direction. U1, U2, V1, and V2 can be outside the
280   //! bounds of this surface.
281   //! - U1 and U2 isoparametric Bezier curves,
282   //! segmented between V1 and V2, become the two
283   //! bounds of the surface in the v parametric
284   //! direction (0. and 1. u isoparametric curves).
285   //! - V1 and V2 isoparametric Bezier curves,
286   //! segmented between U1 and U2, become the two
287   //! bounds of the surface in the u parametric
288   //! direction (0. and 1. v isoparametric curves).
289   //! The poles and weights tables are modified, but the
290   //! degree of this surface in the u and v parametric
291   //! directions does not change.
292   //! U1 can be greater than U2, and V1 can be greater
293   //! than V2. In these cases, the corresponding
294   //! parametric direction is inverted. The orientation of
295   //! the surface is inverted if one (and only one)
296   //! parametric direction is inverted.
297   Standard_EXPORT void Segment (const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2);
298   
299   //! Modifies a pole value.
300   //! If the surface is rational the weight of range (UIndex, VIndex)
301   //! is not modified.
302   //!
303   //! Raised if  UIndex < 1 or UIndex > NbUPoles  or  VIndex < 1
304   //! or VIndex > NbVPoles.
305   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P);
306   
307
308   //! Substitutes the pole and the weight of range UIndex, VIndex.
309   //! If the surface <me> is not rational it can become rational.
310   //! if the surface was rational it can become non-rational.
311   //!
312   //! raises if  UIndex < 1 or UIndex > NbUPoles  or  VIndex < 1
313   //! or VIndex > NbVPoles.
314   //! Raised if Weight <= Resolution from package gp.
315   Standard_EXPORT void SetPole (const Standard_Integer UIndex, const Standard_Integer VIndex, const gp_Pnt& P, const Standard_Real Weight);
316   
317   //! Modifies a column of poles.
318   //! The length of CPoles can be lower but not greater than NbUPoles
319   //! so you can modify just a part of the column.
320   //! Raised if VIndex < 1 or  VIndex > NbVPoles
321   //!
322   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
323   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
324   
325   //! Modifies a column of poles.
326   //! If the surface was rational it can become non-rational
327   //! If the surface was non-rational it can become rational.
328   //! The length of CPoles can be lower but not greater than NbUPoles
329   //! so you can modify just a part of the column.
330   //! Raised if VIndex < 1 or  VIndex > NbVPoles
331   //!
332   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
333   //! Raised if CPoleWeights and CPoles have not the same bounds.
334   //! Raised if one of the weight value CPoleWeights (i) is lower
335   //! or equal to Resolution from package gp.
336   Standard_EXPORT void SetPoleCol (const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
337   
338   //! Modifies a row of poles.
339   //! The length of CPoles can be lower but not greater than NbVPoles
340   //! so you can modify just a part of the row.
341   //! Raised if UIndex < 1 or  UIndex > NbUPoles
342   //!
343   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
344   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
345   
346   //! Modifies a row of poles and weights.
347   //! If the surface was rational it can become non-rational.
348   //! If the surface was non-rational it can become rational.
349   //! The length of CPoles can be lower but not greater than NbVPoles
350   //! so you can modify just a part of the row.
351   //! Raised if UIndex < 1 or  UIndex > NbUPoles
352   //!
353   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
354   //! Raised if CPoleWeights and CPoles have not the same bounds.
355   //! Raised if one of the weight value CPoleWeights (i) is lower
356   //! or equal to Resolution from gp.
357   Standard_EXPORT void SetPoleRow (const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles, const TColStd_Array1OfReal& CPoleWeights);
358   
359
360   //! Modifies the weight of the pole of range UIndex, VIndex.
361   //! If the surface was non-rational it can become rational.
362   //! If the surface was rational it can become non-rational.
363   //!
364   //! Raised if UIndex < 1  or  UIndex > NbUPoles or VIndex < 1 or
365   //! VIndex > NbVPoles.
366   //! Raised if Weight <= Resolution from package gp.
367   Standard_EXPORT void SetWeight (const Standard_Integer UIndex, const Standard_Integer VIndex, const Standard_Real Weight);
368   
369   //! Modifies a column of weights.
370   //! If the surface was rational it can become non-rational.
371   //! If the surface was non-rational it can become rational.
372   //! The length of CPoleWeights can be lower but not greater than
373   //! NbUPoles.
374   //! Raised if VIndex < 1 or  VIndex > NbVPoles
375   //!
376   //! Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() >
377   //! NbUPoles
378   //! Raised if one of the weight value CPoleWeights (i) is lower
379   //! or equal to Resolution from package gp.
380   Standard_EXPORT void SetWeightCol (const Standard_Integer VIndex, const TColStd_Array1OfReal& CPoleWeights);
381   
382   //! Modifies a row of weights.
383   //! If the surface was rational it can become non-rational.
384   //! If the surface was non-rational it can become rational.
385   //! The length of CPoleWeights can be lower but not greater than
386   //! NbVPoles.
387   //! Raised if UIndex < 1 or  UIndex > NbUPoles
388   //!
389   //! Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() >
390   //! NbVPoles
391   //! Raised if one of the weight value CPoleWeights (i) is lower
392   //! or equal to Resolution from package gp.
393   Standard_EXPORT void SetWeightRow (const Standard_Integer UIndex, const TColStd_Array1OfReal& CPoleWeights);
394   
395   //! Changes the orientation of this Bezier surface in the
396   //! u  parametric direction. The bounds of the
397   //! surface are not changed, but the given parametric
398   //! direction is reversed. Hence, the orientation of the surface is reversed.
399   Standard_EXPORT void UReverse() Standard_OVERRIDE;
400   
401   //! Computes the u (or v) parameter on the modified
402   //! surface, produced by reversing its u (or v) parametric
403   //! direction, for any point of u parameter U (or of v
404   //! parameter V) on this Bezier surface.
405   //! In the case of a Bezier surface, these functions return respectively:
406   //! - 1.-U, or 1.-V.
407   Standard_EXPORT Standard_Real UReversedParameter (const Standard_Real U) const Standard_OVERRIDE;
408   
409   //! Changes the orientation of this Bezier surface in the
410   //! v parametric direction. The bounds of the
411   //! surface are not changed, but the given parametric
412   //! direction is reversed. Hence, the orientation of the
413   //! surface is reversed.
414   Standard_EXPORT void VReverse() Standard_OVERRIDE;
415   
416   //! Computes the u (or v) parameter on the modified
417   //! surface, produced by reversing its u (or v) parametric
418   //! direction, for any point of u parameter U (or of v
419   //! parameter V) on this Bezier surface.
420   //! In the case of a Bezier surface, these functions return respectively:
421   //! - 1.-U, or 1.-V.
422   Standard_EXPORT Standard_Real VReversedParameter (const Standard_Real V) const Standard_OVERRIDE;
423   
424   //! Returns the parametric bounds U1, U2, V1 and V2 of
425   //! this Bezier surface.
426   //! In the case of a Bezier surface, this function returns
427   //! U1 = 0, V1 = 0, U2 = 1, V2 = 1.
428   Standard_EXPORT void Bounds (Standard_Real& U1, Standard_Real& U2, Standard_Real& V1, Standard_Real& V2) const Standard_OVERRIDE;
429   
430
431   //! Returns the continuity of the surface CN : the order of
432   //! continuity is infinite.
433   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
434   
435   Standard_EXPORT void D0 (const Standard_Real U, const Standard_Real V, gp_Pnt& P) const Standard_OVERRIDE;
436   
437   Standard_EXPORT void D1 (const Standard_Real U, const Standard_Real V, gp_Pnt& P, gp_Vec& D1U, gp_Vec& D1V) const Standard_OVERRIDE;
438   
439   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;
440   
441   //! Computes P, the point of parameters (U, V) of this Bezier surface, and
442   //! - one or more of the following sets of vectors:
443   //! - D1U and D1V, the first derivative vectors at this point,
444   //! - D2U, D2V and D2UV, the second derivative
445   //! vectors at this point,
446   //! - D3U, D3V, D3UUV and D3UVV, the third
447   //! derivative vectors at this point.
448   //! Note: The parameters U and V can be outside the bounds of the surface.
449   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;
450   
451   //! Computes the derivative of order Nu in the u
452   //! parametric direction, and Nv in the v parametric
453   //! direction, at the point of parameters (U, V) of this Bezier surface.
454   //! Note: The parameters U and V can be outside the bounds of the surface.
455   //! Exceptions
456   //! Standard_RangeError if:
457   //! - Nu + Nv is less than 1, or Nu or Nv is negative.
458   Standard_EXPORT gp_Vec DN (const Standard_Real U, const Standard_Real V, const Standard_Integer Nu, const Standard_Integer Nv) const Standard_OVERRIDE;
459   
460   //! Returns the number of poles in the U direction.
461   Standard_EXPORT Standard_Integer NbUPoles() const;
462   
463   //! Returns the number of poles in the V direction.
464   Standard_EXPORT Standard_Integer NbVPoles() const;
465   
466   //! Returns the pole of range UIndex, VIndex
467   //! Raised if UIndex < 1 or UIndex > NbUPoles, or
468   //! VIndex < 1 or VIndex > NbVPoles.
469   Standard_EXPORT gp_Pnt Pole (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
470   
471   //! Returns the poles of the Bezier surface.
472   //!
473   //! Raised if the length of P in the U an V direction is not equal to
474   //! NbUPoles and NbVPoles.
475   Standard_EXPORT void Poles (TColgp_Array2OfPnt& P) const;
476
477   //! Returns the poles of the Bezier surface.
478   const TColgp_Array2OfPnt& Poles() const
479   {
480     return poles->Array2();
481   }
482
483   //! Returns the degree of the surface in the U direction it is
484   //! NbUPoles - 1
485   Standard_EXPORT Standard_Integer UDegree() const;
486   
487
488   //! Computes the U isoparametric curve. For a Bezier surface the
489   //! UIso curve is a Bezier curve.
490   Standard_EXPORT Handle(Geom_Curve) UIso (const Standard_Real U) const Standard_OVERRIDE;
491   
492
493   //! Returns the degree of the surface in the V direction it is
494   //! NbVPoles - 1
495   Standard_EXPORT Standard_Integer VDegree() const;
496   
497
498   //! Computes the V isoparametric curve. For a Bezier surface the
499   //! VIso  curve is a Bezier curve.
500   Standard_EXPORT Handle(Geom_Curve) VIso (const Standard_Real V) const Standard_OVERRIDE;
501   
502   //! Returns the weight of range UIndex, VIndex
503   //!
504   //! Raised if UIndex < 1 or UIndex > NbUPoles, or
505   //! VIndex < 1 or VIndex > NbVPoles.
506   Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
507   
508   //! Returns the weights of the Bezier surface.
509   //!
510   //! Raised if the length of W in the U an V direction is not
511   //! equal to NbUPoles and NbVPoles.
512   Standard_EXPORT void Weights (TColStd_Array2OfReal& W) const;
513   
514   //! Returns the weights of the Bezier surface.
515   const TColStd_Array2OfReal* Weights() const
516   {
517     if (!weights.IsNull())
518       return &weights->Array2();
519     return BSplSLib::NoWeights();
520   }
521
522   //! Returns True if the first control points row and the
523   //! last control points row are identical. The tolerance
524   //! criterion is Resolution from package gp.
525   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
526   
527
528   //! Returns True if the first control points column
529   //! and the last control points column are identical.
530   //! The tolerance criterion is Resolution from package gp.
531   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
532   
533   //! Returns True, a Bezier surface is always  CN
534   Standard_EXPORT Standard_Boolean IsCNu (const Standard_Integer N) const Standard_OVERRIDE;
535   
536   //! Returns True, a BezierSurface is always  CN
537   Standard_EXPORT Standard_Boolean IsCNv (const Standard_Integer N) const Standard_OVERRIDE;
538   
539   //! Returns False.
540   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
541   
542   //! Returns False.
543   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
544   
545
546   //! Returns False if the weights are identical in the U direction,
547   //! The tolerance criterion is Resolution from package gp.
548   //! Example :
549   //! |1.0, 1.0, 1.0|
550   //! if Weights =  |0.5, 0.5, 0.5|   returns False
551   //! |2.0, 2.0, 2.0|
552   Standard_EXPORT Standard_Boolean IsURational() const;
553   
554
555   //! Returns False if the weights are identical in the V direction,
556   //! The tolerance criterion is Resolution from package gp.
557   //! Example :
558   //! |1.0, 2.0, 0.5|
559   //! if Weights =  |1.0, 2.0, 0.5|   returns False
560   //! |1.0, 2.0, 0.5|
561   Standard_EXPORT Standard_Boolean IsVRational() const;
562   
563   //! Applies the transformation T to this Bezier surface.
564   Standard_EXPORT void Transform (const gp_Trsf& T) Standard_OVERRIDE;
565   
566
567   //! Returns the value of the maximum polynomial degree of a
568   //! Bezier surface. This value is 25.
569   Standard_EXPORT static Standard_Integer MaxDegree();
570   
571   //! Computes two tolerance values for this Bezier
572   //! surface, based on the given tolerance in 3D space
573   //! Tolerance3D. The tolerances computed are:
574   //! - UTolerance in the u parametric direction, and
575   //! - VTolerance in the v parametric direction.
576   //! If f(u,v) is the equation of this Bezier surface,
577   //! UTolerance and VTolerance guarantee that:
578   //! | u1 - u0 | < UTolerance and
579   //! | v1 - v0 | < VTolerance
580   //! ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D
581   Standard_EXPORT void Resolution (const Standard_Real Tolerance3D, Standard_Real& UTolerance, Standard_Real& VTolerance);
582   
583   //! Creates a new object which is a copy of this Bezier surface.
584   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
585
586
587
588
589   DEFINE_STANDARD_RTTIEXT(Geom_BezierSurface,Geom_BoundedSurface)
590
591 protected:
592
593
594
595
596 private:
597
598   
599   Geom_BezierSurface(const Handle(TColgp_HArray2OfPnt)& SurfacePoles, const Handle(TColStd_HArray2OfReal)& PoleWeights, const Standard_Boolean IsURational, const Standard_Boolean IsVRational);
600   
601   //! Set  poles  to  Poles,  weights to  Weights  (not
602   //! copied).
603   //! Create the arrays of coefficients.  Poles
604   //! and    Weights  are   assumed   to  have the  first
605   //! coefficient 1.
606   //!
607   //! if nbpoles < 2 or nbpoles > MaDegree
608   void Init (const Handle(TColgp_HArray2OfPnt)& Poles, const Handle(TColStd_HArray2OfReal)& Weights);
609   
610
611   Standard_Boolean urational;
612   Standard_Boolean vrational;
613   Handle(TColgp_HArray2OfPnt) poles;
614   Handle(TColStd_HArray2OfReal) weights;
615   Standard_Real umaxderivinv;
616   Standard_Real vmaxderivinv;
617   Standard_Boolean maxderivinvok;
618
619
620 };
621
622
623
624
625
626
627
628 #endif // _Geom_BezierSurface_HeaderFile