Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:36:01

0001 // Created on: 1993-03-09
0002 // Created by: JCV
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _Geom_BezierSurface_HeaderFile
0018 #define _Geom_BezierSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TColgp_HArray2OfPnt.hxx>
0024 #include <TColStd_HArray2OfReal.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Geom_BoundedSurface.hxx>
0027 #include <TColgp_Array2OfPnt.hxx>
0028 #include <TColStd_Array2OfReal.hxx>
0029 #include <TColgp_Array1OfPnt.hxx>
0030 #include <TColStd_Array1OfReal.hxx>
0031 #include <GeomAbs_Shape.hxx>
0032 #include <BSplSLib.hxx>
0033 
0034 class gp_Pnt;
0035 class gp_Vec;
0036 class Geom_Curve;
0037 class gp_Trsf;
0038 class Geom_Geometry;
0039 
0040 class Geom_BezierSurface;
0041 DEFINE_STANDARD_HANDLE(Geom_BezierSurface, Geom_BoundedSurface)
0042 
0043 //! Describes a rational or non-rational Bezier surface.
0044 //! - A non-rational Bezier surface is defined by a table
0045 //! of poles (also known as control points).
0046 //! - A rational Bezier surface is defined by a table of
0047 //! poles with varying associated weights.
0048 //! This data is manipulated using two associative 2D arrays:
0049 //! - the poles table, which is a 2D array of gp_Pnt, and
0050 //! - the weights table, which is a 2D array of reals.
0051 //! The bounds of these arrays are:
0052 //! - 1 and NbUPoles for the row bounds, where
0053 //! NbUPoles is the number of poles of the surface
0054 //! in the u parametric direction, and
0055 //! - 1 and NbVPoles for the column bounds, where
0056 //! NbVPoles is the number of poles of the surface
0057 //! in the v parametric direction.
0058 //! The poles of the surface, the "control points", are the
0059 //! points used to shape and reshape the surface. They
0060 //! comprise a rectangular network of points:
0061 //! - The points (1, 1), (NbUPoles, 1), (1,
0062 //! NbVPoles) and (NbUPoles, NbVPoles)
0063 //! are the four parametric "corners" of the surface.
0064 //! - The first column of poles and the last column of
0065 //! poles define two Bezier curves which delimit the
0066 //! surface in the v parametric direction. These are
0067 //! the v isoparametric curves corresponding to
0068 //! values 0 and 1 of the v parameter.
0069 //! - The first row of poles and the last row of poles
0070 //! define two Bezier curves which delimit the surface
0071 //! in the u parametric direction. These are the u
0072 //! isoparametric curves corresponding to values 0
0073 //! and 1 of the u parameter.
0074 //! It is more difficult to define a geometrical significance
0075 //! for the weights. However they are useful for
0076 //! representing a quadric surface precisely. Moreover, if
0077 //! the weights of all the poles are equal, the surface has
0078 //! a polynomial equation, and hence is a "non-rational surface".
0079 //! The non-rational surface is a special, but frequently
0080 //! used, case, where all poles have identical weights.
0081 //! The weights are defined and used only in the case of
0082 //! a rational surface. This rational characteristic is
0083 //! defined in each parametric direction. Hence, a
0084 //! surface can be rational in the u parametric direction,
0085 //! and non-rational in the v parametric direction.
0086 //! Likewise, the degree of a surface is defined in each
0087 //! parametric direction. The degree of a Bezier surface
0088 //! in a given parametric direction is equal to the number
0089 //! of poles of the surface in that parametric direction,
0090 //! minus 1. This must be greater than or equal to 1.
0091 //! However, the degree for a Geom_BezierSurface is
0092 //! limited to a value of (25) which is defined and
0093 //! controlled by the system. This value is returned by the
0094 //! function MaxDegree.
0095 //! The parameter range for a Bezier surface is [ 0, 1 ]
0096 //! in the two parametric directions.
0097 //! A Bezier surface can also be closed, or open, in each
0098 //! parametric direction. If the first row of poles is
0099 //! identical to the last row of poles, the surface is closed
0100 //! in the u parametric direction. If the first column of
0101 //! poles is identical to the last column of poles, the
0102 //! surface is closed in the v parametric direction.
0103 //! The continuity of a Bezier surface is infinite in the u
0104 //! parametric direction and the in v parametric direction.
0105 //! Note: It is not possible to build a Bezier surface with
0106 //! negative weights. Any weight value that is less than,
0107 //! or equal to, gp::Resolution() is considered
0108 //! to be zero. Two weight values, W1 and W2, are
0109 //! considered equal if: |W2-W1| <= gp::Resolution()
0110 class Geom_BezierSurface : public Geom_BoundedSurface
0111 {
0112 
0113 public:
0114   //! Creates a non-rational Bezier surface with a set of poles.
0115   //! Control points representation :
0116   //! SPoles(Uorigin,Vorigin) ...................SPoles(Uorigin,Vend)
0117   //! .                                     .
0118   //! .                                     .
0119   //! SPoles(Uend, Vorigin) .....................SPoles(Uend, Vend)
0120   //! For the double array the row indice corresponds to the parametric
0121   //! U direction and the columns indice corresponds to the parametric
0122   //! V direction.
0123   //! The weights are defaulted to all being 1.
0124   //!
0125   //! Raised if the number of poles of the surface is lower than 2
0126   //! or greater than MaxDegree + 1 in one of the two directions
0127   //! U or V.
0128   Standard_EXPORT Geom_BezierSurface(const TColgp_Array2OfPnt& SurfacePoles);
0129 
0130   //! ---Purpose
0131   //! Creates a rational Bezier surface with a set of poles and a
0132   //! set of weights.
0133   //! For the double array the row indice corresponds to the parametric
0134   //! U direction and the columns indice corresponds to the parametric
0135   //! V direction.
0136   //! If all the weights are identical the surface is considered as
0137   //! non-rational (the tolerance criterion is Resolution from package
0138   //! gp).
0139   //!
0140   //! Raised if SurfacePoles and PoleWeights have not the same
0141   //! Rowlength or have not the same ColLength.
0142   //! Raised if PoleWeights (i, j) <= Resolution from gp;
0143   //! Raised if the number of poles of the surface is lower than 2
0144   //! or greater than MaxDegree + 1 in one of the two directions U or V.
0145   Standard_EXPORT Geom_BezierSurface(const TColgp_Array2OfPnt&   SurfacePoles,
0146                                      const TColStd_Array2OfReal& PoleWeights);
0147 
0148   //! Exchanges the direction U and V on a Bezier surface
0149   //! As a consequence:
0150   //! - the poles and weights tables are transposed,
0151   //! - degrees, rational characteristics and so on are
0152   //! exchanged between the two parametric directions, and
0153   //! - the orientation of the surface is reversed.
0154   Standard_EXPORT void ExchangeUV();
0155 
0156   //! Increases the degree of this Bezier surface in the two parametric directions.
0157   //!
0158   //! Raised if UDegree < UDegree <me>  or VDegree < VDegree <me>
0159   //! Raised if the degree of the surface is greater than MaxDegree
0160   //! in one of the two directions U or V.
0161   Standard_EXPORT void Increase(const Standard_Integer UDeg, const Standard_Integer VDeg);
0162 
0163   //! Inserts a column of poles. If the surface is rational the weights
0164   //! values associated with CPoles are equal defaulted to 1.
0165   //!
0166   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0167   //!
0168   //! raises if VDegree is greater than MaxDegree.
0169   //! raises if the Length of CPoles is not equal to NbUPoles
0170   Standard_EXPORT void InsertPoleColAfter(const Standard_Integer    VIndex,
0171                                           const TColgp_Array1OfPnt& CPoles);
0172 
0173   //! Inserts a column of poles and weights.
0174   //! If the surface was non-rational it can become rational.
0175   //!
0176   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0177   //! Raised if
0178   //! . VDegree is greater than MaxDegree.
0179   //! . the Length of CPoles is not equal to NbUPoles
0180   //! . a weight value is lower or equal to Resolution from
0181   //! package gp
0182   Standard_EXPORT void InsertPoleColAfter(const Standard_Integer      VIndex,
0183                                           const TColgp_Array1OfPnt&   CPoles,
0184                                           const TColStd_Array1OfReal& CPoleWeights);
0185 
0186   //! Inserts a column of poles. If the surface is rational the weights
0187   //! values associated with CPoles are equal defaulted to 1.
0188   //!
0189   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0190   //!
0191   //! Raised if VDegree is greater than MaxDegree.
0192   //! Raised if the Length of CPoles is not equal to NbUPoles
0193   Standard_EXPORT void InsertPoleColBefore(const Standard_Integer    VIndex,
0194                                            const TColgp_Array1OfPnt& CPoles);
0195 
0196   //! Inserts a column of poles and weights.
0197   //! If the surface was non-rational it can become rational.
0198   //!
0199   //! Raised if Vindex < 1 or VIndex > NbVPoles.
0200   //! Raised if :
0201   //! . VDegree is greater than MaxDegree.
0202   //! . the Length of CPoles is not equal to NbUPoles
0203   //! . a weight value is lower or equal to Resolution from
0204   //! package gp
0205   Standard_EXPORT void InsertPoleColBefore(const Standard_Integer      VIndex,
0206                                            const TColgp_Array1OfPnt&   CPoles,
0207                                            const TColStd_Array1OfReal& CPoleWeights);
0208 
0209   //! Inserts a row of poles. If the surface is rational the weights
0210   //! values associated with CPoles are equal defaulted to 1.
0211   //!
0212   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0213   //!
0214   //! Raised if UDegree is greater than MaxDegree.
0215   //! Raised if the Length of CPoles is not equal to NbVPoles
0216   Standard_EXPORT void InsertPoleRowAfter(const Standard_Integer    UIndex,
0217                                           const TColgp_Array1OfPnt& CPoles);
0218 
0219   //! Inserts a row of poles and weights.
0220   //! If the surface was non-rational it can become rational.
0221   //!
0222   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0223   //! Raised if :
0224   //! . UDegree is greater than MaxDegree.
0225   //! . the Length of CPoles is not equal to NbVPoles
0226   //! . a weight value is lower or equal to Resolution from
0227   //! package gp
0228   Standard_EXPORT void InsertPoleRowAfter(const Standard_Integer      UIndex,
0229                                           const TColgp_Array1OfPnt&   CPoles,
0230                                           const TColStd_Array1OfReal& CPoleWeights);
0231 
0232   //! Inserts a row of poles. If the surface is rational the weights
0233   //! values associated with CPoles are equal defaulted to 1.
0234   //!
0235   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0236   //!
0237   //! Raised if UDegree is greater than MaxDegree.
0238   //! Raised if the Length of CPoles is not equal to NbVPoles
0239   Standard_EXPORT void InsertPoleRowBefore(const Standard_Integer    UIndex,
0240                                            const TColgp_Array1OfPnt& CPoles);
0241 
0242   //! Inserts a row of poles and weights.
0243   //! If the surface was non-rational it can become rational.
0244   //!
0245   //! Raised if Uindex < 1 or UIndex > NbUPoles.
0246   //! Raised if :
0247   //! . UDegree is greater than MaxDegree.
0248   //! . the Length of CPoles is not equal to NbVPoles
0249   //! . a weight value is lower or equal to Resolution from
0250   //! package gp
0251   Standard_EXPORT void InsertPoleRowBefore(const Standard_Integer      UIndex,
0252                                            const TColgp_Array1OfPnt&   CPoles,
0253                                            const TColStd_Array1OfReal& CPoleWeights);
0254 
0255   //! Removes a column of poles.
0256   //! If the surface was rational it can become non-rational.
0257   //!
0258   //! Raised if NbVPoles <= 2 after removing, a Bezier surface
0259   //! must have at least two columns of poles.
0260   //! Raised if Vindex < 1 or VIndex > NbVPoles
0261   Standard_EXPORT void RemovePoleCol(const Standard_Integer VIndex);
0262 
0263   //! Removes a row of poles.
0264   //! If the surface was rational it can become non-rational.
0265   //!
0266   //! Raised if NbUPoles <= 2 after removing, a Bezier surface
0267   //! must have at least two rows of poles.
0268   //! Raised if Uindex < 1 or UIndex > NbUPoles
0269   Standard_EXPORT void RemovePoleRow(const Standard_Integer UIndex);
0270 
0271   //! Modifies this Bezier surface by segmenting it
0272   //! between U1 and U2 in the u parametric direction,
0273   //! and between V1 and V2 in the v parametric
0274   //! direction. U1, U2, V1, and V2 can be outside the
0275   //! bounds of this surface.
0276   //! - U1 and U2 isoparametric Bezier curves,
0277   //! segmented between V1 and V2, become the two
0278   //! bounds of the surface in the v parametric
0279   //! direction (0. and 1. u isoparametric curves).
0280   //! - V1 and V2 isoparametric Bezier curves,
0281   //! segmented between U1 and U2, become the two
0282   //! bounds of the surface in the u parametric
0283   //! direction (0. and 1. v isoparametric curves).
0284   //! The poles and weights tables are modified, but the
0285   //! degree of this surface in the u and v parametric
0286   //! directions does not change.
0287   //! U1 can be greater than U2, and V1 can be greater
0288   //! than V2. In these cases, the corresponding
0289   //! parametric direction is inverted. The orientation of
0290   //! the surface is inverted if one (and only one)
0291   //! parametric direction is inverted.
0292   Standard_EXPORT void Segment(const Standard_Real U1,
0293                                const Standard_Real U2,
0294                                const Standard_Real V1,
0295                                const Standard_Real V2);
0296 
0297   //! Modifies a pole value.
0298   //! If the surface is rational the weight of range (UIndex, VIndex)
0299   //! is not modified.
0300   //!
0301   //! Raised if  UIndex < 1 or UIndex > NbUPoles  or  VIndex < 1
0302   //! or VIndex > NbVPoles.
0303   Standard_EXPORT void SetPole(const Standard_Integer UIndex,
0304                                const Standard_Integer VIndex,
0305                                const gp_Pnt&          P);
0306 
0307   //! Substitutes the pole and the weight of range UIndex, VIndex.
0308   //! If the surface <me> is not rational it can become rational.
0309   //! if the surface was rational it can become non-rational.
0310   //!
0311   //! raises if  UIndex < 1 or UIndex > NbUPoles  or  VIndex < 1
0312   //! or VIndex > NbVPoles.
0313   //! Raised if Weight <= Resolution from package gp.
0314   Standard_EXPORT void SetPole(const Standard_Integer UIndex,
0315                                const Standard_Integer VIndex,
0316                                const gp_Pnt&          P,
0317                                const Standard_Real    Weight);
0318 
0319   //! Modifies a column of poles.
0320   //! The length of CPoles can be lower but not greater than NbUPoles
0321   //! so you can modify just a part of the column.
0322   //! Raised if VIndex < 1 or  VIndex > NbVPoles
0323   //!
0324   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
0325   Standard_EXPORT void SetPoleCol(const Standard_Integer VIndex, const TColgp_Array1OfPnt& CPoles);
0326 
0327   //! Modifies a column of poles.
0328   //! If the surface was rational it can become non-rational
0329   //! If the surface was non-rational it can become rational.
0330   //! The length of CPoles can be lower but not greater than NbUPoles
0331   //! so you can modify just a part of the column.
0332   //! Raised if VIndex < 1 or  VIndex > NbVPoles
0333   //!
0334   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbUPoles
0335   //! Raised if CPoleWeights and CPoles have not the same bounds.
0336   //! Raised if one of the weight value CPoleWeights (i) is lower
0337   //! or equal to Resolution from package gp.
0338   Standard_EXPORT void SetPoleCol(const Standard_Integer      VIndex,
0339                                   const TColgp_Array1OfPnt&   CPoles,
0340                                   const TColStd_Array1OfReal& CPoleWeights);
0341 
0342   //! Modifies a row of poles.
0343   //! The length of CPoles can be lower but not greater than NbVPoles
0344   //! so you can modify just a part of the row.
0345   //! Raised if UIndex < 1 or  UIndex > NbUPoles
0346   //!
0347   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
0348   Standard_EXPORT void SetPoleRow(const Standard_Integer UIndex, const TColgp_Array1OfPnt& CPoles);
0349 
0350   //! Modifies a row of poles and weights.
0351   //! If the surface was rational it can become non-rational.
0352   //! If the surface was non-rational it can become rational.
0353   //! The length of CPoles can be lower but not greater than NbVPoles
0354   //! so you can modify just a part of the row.
0355   //! Raised if UIndex < 1 or  UIndex > NbUPoles
0356   //!
0357   //! Raised if CPoles.Lower() < 1 or CPoles.Upper() > NbVPoles
0358   //! Raised if CPoleWeights and CPoles have not the same bounds.
0359   //! Raised if one of the weight value CPoleWeights (i) is lower
0360   //! or equal to Resolution from gp.
0361   Standard_EXPORT void SetPoleRow(const Standard_Integer      UIndex,
0362                                   const TColgp_Array1OfPnt&   CPoles,
0363                                   const TColStd_Array1OfReal& CPoleWeights);
0364 
0365   //! Modifies the weight of the pole of range UIndex, VIndex.
0366   //! If the surface was non-rational it can become rational.
0367   //! If the surface was rational it can become non-rational.
0368   //!
0369   //! Raised if UIndex < 1  or  UIndex > NbUPoles or VIndex < 1 or
0370   //! VIndex > NbVPoles.
0371   //! Raised if Weight <= Resolution from package gp.
0372   Standard_EXPORT void SetWeight(const Standard_Integer UIndex,
0373                                  const Standard_Integer VIndex,
0374                                  const Standard_Real    Weight);
0375 
0376   //! Modifies a column of weights.
0377   //! If the surface was rational it can become non-rational.
0378   //! If the surface was non-rational it can become rational.
0379   //! The length of CPoleWeights can be lower but not greater than
0380   //! NbUPoles.
0381   //! Raised if VIndex < 1 or  VIndex > NbVPoles
0382   //!
0383   //! Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() >
0384   //! NbUPoles
0385   //! Raised if one of the weight value CPoleWeights (i) is lower
0386   //! or equal to Resolution from package gp.
0387   Standard_EXPORT void SetWeightCol(const Standard_Integer      VIndex,
0388                                     const TColStd_Array1OfReal& CPoleWeights);
0389 
0390   //! Modifies a row of weights.
0391   //! If the surface was rational it can become non-rational.
0392   //! If the surface was non-rational it can become rational.
0393   //! The length of CPoleWeights can be lower but not greater than
0394   //! NbVPoles.
0395   //! Raised if UIndex < 1 or  UIndex > NbUPoles
0396   //!
0397   //! Raised if CPoleWeights.Lower() < 1 or CPoleWeights.Upper() >
0398   //! NbVPoles
0399   //! Raised if one of the weight value CPoleWeights (i) is lower
0400   //! or equal to Resolution from package gp.
0401   Standard_EXPORT void SetWeightRow(const Standard_Integer      UIndex,
0402                                     const TColStd_Array1OfReal& CPoleWeights);
0403 
0404   //! Changes the orientation of this Bezier surface in the
0405   //! u  parametric direction. The bounds of the
0406   //! surface are not changed, but the given parametric
0407   //! direction is reversed. Hence, the orientation of the surface is reversed.
0408   Standard_EXPORT void UReverse() Standard_OVERRIDE;
0409 
0410   //! Computes the u (or v) parameter on the modified
0411   //! surface, produced by reversing its u (or v) parametric
0412   //! direction, for any point of u parameter U (or of v
0413   //! parameter V) on this Bezier surface.
0414   //! In the case of a Bezier surface, these functions return respectively:
0415   //! - 1.-U, or 1.-V.
0416   Standard_EXPORT Standard_Real UReversedParameter(const Standard_Real U) const Standard_OVERRIDE;
0417 
0418   //! Changes the orientation of this Bezier surface in the
0419   //! v parametric direction. The bounds of the
0420   //! surface are not changed, but the given parametric
0421   //! direction is reversed. Hence, the orientation of the
0422   //! surface is reversed.
0423   Standard_EXPORT void VReverse() Standard_OVERRIDE;
0424 
0425   //! Computes the u (or v) parameter on the modified
0426   //! surface, produced by reversing its u (or v) parametric
0427   //! direction, for any point of u parameter U (or of v
0428   //! parameter V) on this Bezier surface.
0429   //! In the case of a Bezier surface, these functions return respectively:
0430   //! - 1.-U, or 1.-V.
0431   Standard_EXPORT Standard_Real VReversedParameter(const Standard_Real V) const Standard_OVERRIDE;
0432 
0433   //! Returns the parametric bounds U1, U2, V1 and V2 of
0434   //! this Bezier surface.
0435   //! In the case of a Bezier surface, this function returns
0436   //! U1 = 0, V1 = 0, U2 = 1, V2 = 1.
0437   Standard_EXPORT void Bounds(Standard_Real& U1,
0438                               Standard_Real& U2,
0439                               Standard_Real& V1,
0440                               Standard_Real& V2) const Standard_OVERRIDE;
0441 
0442   //! Returns the continuity of the surface CN : the order of
0443   //! continuity is infinite.
0444   Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE;
0445 
0446   Standard_EXPORT void D0(const Standard_Real U,
0447                           const Standard_Real V,
0448                           gp_Pnt&             P) const Standard_OVERRIDE;
0449 
0450   Standard_EXPORT void D1(const Standard_Real U,
0451                           const Standard_Real V,
0452                           gp_Pnt&             P,
0453                           gp_Vec&             D1U,
0454                           gp_Vec&             D1V) const Standard_OVERRIDE;
0455 
0456   Standard_EXPORT void D2(const Standard_Real U,
0457                           const Standard_Real V,
0458                           gp_Pnt&             P,
0459                           gp_Vec&             D1U,
0460                           gp_Vec&             D1V,
0461                           gp_Vec&             D2U,
0462                           gp_Vec&             D2V,
0463                           gp_Vec&             D2UV) const Standard_OVERRIDE;
0464 
0465   //! Computes P, the point of parameters (U, V) of this Bezier surface, and
0466   //! - one or more of the following sets of vectors:
0467   //! - D1U and D1V, the first derivative vectors at this point,
0468   //! - D2U, D2V and D2UV, the second derivative
0469   //! vectors at this point,
0470   //! - D3U, D3V, D3UUV and D3UVV, the third
0471   //! derivative vectors at this point.
0472   //! Note: The parameters U and V can be outside the bounds of the surface.
0473   Standard_EXPORT void D3(const Standard_Real U,
0474                           const Standard_Real V,
0475                           gp_Pnt&             P,
0476                           gp_Vec&             D1U,
0477                           gp_Vec&             D1V,
0478                           gp_Vec&             D2U,
0479                           gp_Vec&             D2V,
0480                           gp_Vec&             D2UV,
0481                           gp_Vec&             D3U,
0482                           gp_Vec&             D3V,
0483                           gp_Vec&             D3UUV,
0484                           gp_Vec&             D3UVV) const Standard_OVERRIDE;
0485 
0486   //! Computes the derivative of order Nu in the u
0487   //! parametric direction, and Nv in the v parametric
0488   //! direction, at the point of parameters (U, V) of this Bezier surface.
0489   //! Note: The parameters U and V can be outside the bounds of the surface.
0490   //! Exceptions
0491   //! Standard_RangeError if:
0492   //! - Nu + Nv is less than 1, or Nu or Nv is negative.
0493   Standard_EXPORT gp_Vec DN(const Standard_Real    U,
0494                             const Standard_Real    V,
0495                             const Standard_Integer Nu,
0496                             const Standard_Integer Nv) const Standard_OVERRIDE;
0497 
0498   //! Returns the number of poles in the U direction.
0499   Standard_EXPORT Standard_Integer NbUPoles() const;
0500 
0501   //! Returns the number of poles in the V direction.
0502   Standard_EXPORT Standard_Integer NbVPoles() const;
0503 
0504   //! Returns the pole of range UIndex, VIndex
0505   //! Raised if UIndex < 1 or UIndex > NbUPoles, or
0506   //! VIndex < 1 or VIndex > NbVPoles.
0507   Standard_EXPORT const gp_Pnt& Pole(const Standard_Integer UIndex,
0508                                      const Standard_Integer VIndex) const;
0509 
0510   //! Returns the poles of the Bezier surface.
0511   //!
0512   //! Raised if the length of P in the U an V direction is not equal to
0513   //! NbUPoles and NbVPoles.
0514   Standard_EXPORT void Poles(TColgp_Array2OfPnt& P) const;
0515 
0516   //! Returns the poles of the Bezier surface.
0517   const TColgp_Array2OfPnt& Poles() const { return poles->Array2(); }
0518 
0519   //! Returns the degree of the surface in the U direction it is
0520   //! NbUPoles - 1
0521   Standard_EXPORT Standard_Integer UDegree() const;
0522 
0523   //! Computes the U isoparametric curve. For a Bezier surface the
0524   //! UIso curve is a Bezier curve.
0525   Standard_EXPORT Handle(Geom_Curve) UIso(const Standard_Real U) const Standard_OVERRIDE;
0526 
0527   //! Returns the degree of the surface in the V direction it is
0528   //! NbVPoles - 1
0529   Standard_EXPORT Standard_Integer VDegree() const;
0530 
0531   //! Computes the V isoparametric curve. For a Bezier surface the
0532   //! VIso  curve is a Bezier curve.
0533   Standard_EXPORT Handle(Geom_Curve) VIso(const Standard_Real V) const Standard_OVERRIDE;
0534 
0535   //! Returns the weight of range UIndex, VIndex
0536   //!
0537   //! Raised if UIndex < 1 or UIndex > NbUPoles, or
0538   //! VIndex < 1 or VIndex > NbVPoles.
0539   Standard_EXPORT Standard_Real Weight(const Standard_Integer UIndex,
0540                                        const Standard_Integer VIndex) const;
0541 
0542   //! Returns the weights of the Bezier surface.
0543   //!
0544   //! Raised if the length of W in the U an V direction is not
0545   //! equal to NbUPoles and NbVPoles.
0546   Standard_EXPORT void Weights(TColStd_Array2OfReal& W) const;
0547 
0548   //! Returns the weights of the Bezier surface.
0549   const TColStd_Array2OfReal* Weights() const
0550   {
0551     if (!weights.IsNull())
0552       return &weights->Array2();
0553     return BSplSLib::NoWeights();
0554   }
0555 
0556   //! Returns True if the first control points row and the
0557   //! last control points row are identical. The tolerance
0558   //! criterion is Resolution from package gp.
0559   Standard_EXPORT Standard_Boolean IsUClosed() const Standard_OVERRIDE;
0560 
0561   //! Returns True if the first control points column
0562   //! and the last control points column are identical.
0563   //! The tolerance criterion is Resolution from package gp.
0564   Standard_EXPORT Standard_Boolean IsVClosed() const Standard_OVERRIDE;
0565 
0566   //! Returns True, a Bezier surface is always  CN
0567   Standard_EXPORT Standard_Boolean IsCNu(const Standard_Integer N) const Standard_OVERRIDE;
0568 
0569   //! Returns True, a BezierSurface is always  CN
0570   Standard_EXPORT Standard_Boolean IsCNv(const Standard_Integer N) const Standard_OVERRIDE;
0571 
0572   //! Returns False.
0573   Standard_EXPORT Standard_Boolean IsUPeriodic() const Standard_OVERRIDE;
0574 
0575   //! Returns False.
0576   Standard_EXPORT Standard_Boolean IsVPeriodic() const Standard_OVERRIDE;
0577 
0578   //! Returns False if the weights are identical in the U direction,
0579   //! The tolerance criterion is Resolution from package gp.
0580   //! Example :
0581   //! |1.0, 1.0, 1.0|
0582   //! if Weights =  |0.5, 0.5, 0.5|   returns False
0583   //! |2.0, 2.0, 2.0|
0584   Standard_EXPORT Standard_Boolean IsURational() const;
0585 
0586   //! Returns False if the weights are identical in the V direction,
0587   //! The tolerance criterion is Resolution from package gp.
0588   //! Example :
0589   //! |1.0, 2.0, 0.5|
0590   //! if Weights =  |1.0, 2.0, 0.5|   returns False
0591   //! |1.0, 2.0, 0.5|
0592   Standard_EXPORT Standard_Boolean IsVRational() const;
0593 
0594   //! Applies the transformation T to this Bezier surface.
0595   Standard_EXPORT void Transform(const gp_Trsf& T) Standard_OVERRIDE;
0596 
0597   //! Returns the value of the maximum polynomial degree of a
0598   //! Bezier surface. This value is 25.
0599   Standard_EXPORT static Standard_Integer MaxDegree();
0600 
0601   //! Computes two tolerance values for this Bezier
0602   //! surface, based on the given tolerance in 3D space
0603   //! Tolerance3D. The tolerances computed are:
0604   //! - UTolerance in the u parametric direction, and
0605   //! - VTolerance in the v parametric direction.
0606   //! If f(u,v) is the equation of this Bezier surface,
0607   //! UTolerance and VTolerance guarantee that:
0608   //! | u1 - u0 | < UTolerance and
0609   //! | v1 - v0 | < VTolerance
0610   //! ====> |f (u1,v1) - f (u0,v0)| < Tolerance3D
0611   Standard_EXPORT void Resolution(const Standard_Real Tolerance3D,
0612                                   Standard_Real&      UTolerance,
0613                                   Standard_Real&      VTolerance);
0614 
0615   //! Creates a new object which is a copy of this Bezier surface.
0616   Standard_EXPORT Handle(Geom_Geometry) Copy() const Standard_OVERRIDE;
0617 
0618   //! Dumps the content of me into the stream
0619   Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream,
0620                                         Standard_Integer  theDepth = -1) const Standard_OVERRIDE;
0621 
0622   DEFINE_STANDARD_RTTIEXT(Geom_BezierSurface, Geom_BoundedSurface)
0623 
0624 protected:
0625 private:
0626   Geom_BezierSurface(const Handle(TColgp_HArray2OfPnt)&   SurfacePoles,
0627                      const Handle(TColStd_HArray2OfReal)& PoleWeights,
0628                      const Standard_Boolean               IsURational,
0629                      const Standard_Boolean               IsVRational);
0630 
0631   //! Set  poles  to  Poles,  weights to  Weights  (not
0632   //! copied).
0633   //! Create the arrays of coefficients.  Poles
0634   //! and    Weights  are   assumed   to  have the  first
0635   //! coefficient 1.
0636   //!
0637   //! if nbpoles < 2 or nbpoles > MaDegree
0638   void Init(const Handle(TColgp_HArray2OfPnt)& Poles, const Handle(TColStd_HArray2OfReal)& Weights);
0639 
0640   Standard_Boolean              urational;
0641   Standard_Boolean              vrational;
0642   Handle(TColgp_HArray2OfPnt)   poles;
0643   Handle(TColStd_HArray2OfReal) weights;
0644   Standard_Real                 umaxderivinv;
0645   Standard_Real                 vmaxderivinv;
0646   Standard_Boolean              maxderivinvok;
0647 };
0648 
0649 #endif // _Geom_BezierSurface_HeaderFile