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