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