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