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