|
|
|||
File indexing completed on 2026-09-28 09:20:09
0001 // Copyright (c) 2025 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _GeomEval_TBezierSurface_HeaderFile 0015 #define _GeomEval_TBezierSurface_HeaderFile 0016 0017 #include <Geom_BoundedSurface.hxx> 0018 #include <NCollection_Array1.hxx> 0019 #include <NCollection_Array2.hxx> 0020 #include <gp_Pnt.hxx> 0021 0022 class gp_Trsf; 0023 class Geom_Geometry; 0024 class Geom_Curve; 0025 0026 //! Tensor-product Trigonometric Bezier surface. 0027 //! Uses trigonometric Bernstein-like bases in both U and V directions 0028 //! over the space {1, sin(alpha*t), cos(alpha*t), ..., sin(n*alpha*t), cos(n*alpha*t)}. 0029 //! 0030 //! Parameter domain: U in [0, Pi/alphaU], V in [0, Pi/alphaV]. 0031 //! Number of control points: (2*nU + 1) x (2*nV + 1) for orders nU, nV. 0032 //! 0033 //! The surface is: 0034 //! @code 0035 //! S(u,v) = sum_i sum_j P_ij * Bu_i(u) * Bv_j(v) 0036 //! @endcode 0037 //! where Bu_i and Bv_j are trigonometric basis functions in U and V respectively. 0038 //! 0039 //! For rational surfaces: 0040 //! @code 0041 //! S(u,v) = sum_i sum_j (w_ij * P_ij * Bu_i(u) * Bv_j(v)) 0042 //! / sum_i sum_j (w_ij * Bu_i(u) * Bv_j(v)) 0043 //! @endcode 0044 class GeomEval_TBezierSurface : public Geom_BoundedSurface 0045 { 0046 public: 0047 //! Constructs a non-rational T-Bezier surface from poles and alpha parameters. 0048 //! @param[in] thePoles control points grid (row count and col count must be odd >= 3) 0049 //! @param[in] theAlphaU frequency parameter in U direction (must be > 0) 0050 //! @param[in] theAlphaV frequency parameter in V direction (must be > 0) 0051 //! @throw Standard_ConstructionError if validation fails 0052 Standard_EXPORT GeomEval_TBezierSurface(const NCollection_Array2<gp_Pnt>& thePoles, 0053 double theAlphaU, 0054 double theAlphaV); 0055 0056 //! Constructs a rational T-Bezier surface. 0057 //! @param[in] thePoles control points grid 0058 //! @param[in] theWeights weights grid (same dimensions as poles, all > 0) 0059 //! @param[in] theAlphaU frequency parameter in U direction (must be > 0) 0060 //! @param[in] theAlphaV frequency parameter in V direction (must be > 0) 0061 //! @throw Standard_ConstructionError if validation fails 0062 Standard_EXPORT GeomEval_TBezierSurface(const NCollection_Array2<gp_Pnt>& thePoles, 0063 const NCollection_Array2<double>& theWeights, 0064 double theAlphaU, 0065 double theAlphaV); 0066 0067 //! Returns the poles grid. 0068 Standard_EXPORT const NCollection_Array2<gp_Pnt>& Poles() const; 0069 0070 //! Returns the weights grid (empty if non-rational). 0071 Standard_EXPORT const NCollection_Array2<double>& Weights() const; 0072 0073 //! Returns the frequency parameter alpha in the U direction. 0074 Standard_EXPORT double AlphaU() const; 0075 0076 //! Returns the frequency parameter alpha in the V direction. 0077 Standard_EXPORT double AlphaV() const; 0078 0079 //! Returns the number of poles in the U direction. 0080 Standard_EXPORT int NbUPoles() const; 0081 0082 //! Returns the number of poles in the V direction. 0083 Standard_EXPORT int NbVPoles() const; 0084 0085 //! Returns the trigonometric order in U (NbUPoles = 2*nU + 1). 0086 Standard_EXPORT int OrderU() const; 0087 0088 //! Returns the trigonometric order in V (NbVPoles = 2*nV + 1). 0089 Standard_EXPORT int OrderV() const; 0090 0091 //! Returns true if the surface is rational. 0092 Standard_EXPORT bool IsRational() const; 0093 0094 // -- Geom_Surface interface -- 0095 0096 //! Reversal is not supported for this eval surface. 0097 //! @throw Standard_NotImplemented 0098 Standard_EXPORT void UReverse() final; 0099 0100 //! Reversal is not supported for this eval surface. 0101 //! @throw Standard_NotImplemented 0102 Standard_EXPORT double UReversedParameter(const double U) const final; 0103 0104 //! Reversal is not supported for this eval surface. 0105 //! @throw Standard_NotImplemented 0106 Standard_EXPORT void VReverse() final; 0107 0108 //! Reversal is not supported for this eval surface. 0109 //! @throw Standard_NotImplemented 0110 Standard_EXPORT double VReversedParameter(const double V) const final; 0111 0112 //! Returns the parametric bounds. 0113 //! @param[out] U1 lower U bound (0) 0114 //! @param[out] U2 upper U bound (Pi/alphaU) 0115 //! @param[out] V1 lower V bound (0) 0116 //! @param[out] V2 upper V bound (Pi/alphaV) 0117 Standard_EXPORT void Bounds(double& U1, double& U2, double& V1, double& V2) const final; 0118 0119 //! Returns true if the surface is closed in U. 0120 Standard_EXPORT bool IsUClosed() const final; 0121 0122 //! Returns true if the surface is closed in V. 0123 Standard_EXPORT bool IsVClosed() const final; 0124 0125 //! Returns false. T-Bezier surfaces are not periodic in U. 0126 Standard_EXPORT bool IsUPeriodic() const final; 0127 0128 //! Returns false. T-Bezier surfaces are not periodic in V. 0129 Standard_EXPORT bool IsVPeriodic() const final; 0130 0131 //! Returns GeomAbs_CN. T-Bezier surfaces are infinitely differentiable. 0132 Standard_EXPORT GeomAbs_Shape Continuity() const final; 0133 0134 //! Returns true for all N. T-Bezier surfaces are infinitely differentiable in U. 0135 Standard_EXPORT bool IsCNu(const int N) const final; 0136 0137 //! Returns true for all N. T-Bezier surfaces are infinitely differentiable in V. 0138 Standard_EXPORT bool IsCNv(const int N) const final; 0139 0140 //! Isoparametric curve extraction is not supported for this eval surface. 0141 //! @throw Standard_NotImplemented 0142 Standard_EXPORT occ::handle<Geom_Curve> UIso(const double U) const final; 0143 0144 //! Isoparametric curve extraction is not supported for this eval surface. 0145 //! @throw Standard_NotImplemented 0146 Standard_EXPORT occ::handle<Geom_Curve> VIso(const double V) const final; 0147 0148 //! Computes the point S(U, V). 0149 Standard_EXPORT gp_Pnt EvalD0(const double U, const double V) const final; 0150 0151 //! Computes the point and first partial derivatives at (U, V). 0152 Standard_EXPORT Geom_Surface::ResD1 EvalD1(const double U, const double V) const final; 0153 0154 //! Computes the point and partial derivatives up to 2nd order at (U, V). 0155 Standard_EXPORT Geom_Surface::ResD2 EvalD2(const double U, const double V) const final; 0156 0157 //! Computes the point and partial derivatives up to 3rd order at (U, V). 0158 Standard_EXPORT Geom_Surface::ResD3 EvalD3(const double U, const double V) const final; 0159 0160 //! Computes the derivative of order Nu in U and Nv in V. 0161 //! @param[in] U the u parameter 0162 //! @param[in] V the v parameter 0163 //! @param[in] Nu derivative order in U (must be >= 0) 0164 //! @param[in] Nv derivative order in V (must be >= 0) 0165 //! @return the derivative vector 0166 //! @throw Standard_RangeError if Nu + Nv < 1 or Nu < 0 or Nv < 0 0167 Standard_EXPORT gp_Vec EvalDN(const double U, 0168 const double V, 0169 const int Nu, 0170 const int Nv) const final; 0171 0172 //! Transformation is not supported for this eval geometry. 0173 //! @throw Standard_NotImplemented 0174 Standard_EXPORT void Transform(const gp_Trsf& T) final; 0175 0176 //! Creates a new object which is a copy of this T-Bezier surface. 0177 Standard_EXPORT occ::handle<Geom_Geometry> Copy() const final; 0178 0179 //! Dumps the content of me into the stream. 0180 Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const final; 0181 0182 DEFINE_STANDARD_RTTIEXT(GeomEval_TBezierSurface, Geom_BoundedSurface) 0183 0184 private: 0185 //! Evaluate trigonometric basis functions in U at parameter theU. 0186 void evalBasisU(double theU, NCollection_Array1<double>& theBasis) const; 0187 0188 //! Evaluate trigonometric basis functions in V at parameter theV. 0189 void evalBasisV(double theV, NCollection_Array1<double>& theBasis) const; 0190 0191 //! Evaluate derivative of order theOrder of U-basis functions at theU. 0192 void evalBasisDerivU(double theU, int theOrder, NCollection_Array1<double>& theBasisDeriv) const; 0193 0194 //! Evaluate derivative of order theOrder of V-basis functions at theV. 0195 void evalBasisDerivV(double theV, int theOrder, NCollection_Array1<double>& theBasisDeriv) const; 0196 0197 //! Helper: evaluate a single trigonometric basis array for given alpha. 0198 static void evalTrigBasis(double theT, 0199 double theAlpha, 0200 int theOrder, 0201 NCollection_Array1<double>& theBasis); 0202 0203 //! Helper: evaluate derivative of trigonometric basis for given alpha. 0204 static void evalTrigBasisDeriv(double theT, 0205 double theAlpha, 0206 int theOrder, 0207 int theDerivOrder, 0208 NCollection_Array1<double>& theBasisDeriv); 0209 0210 NCollection_Array2<gp_Pnt> myPoles; //!< Control points grid 0211 NCollection_Array2<double> myWeights; //!< Weights grid (empty if non-rational) 0212 double myAlphaU; //!< Frequency parameter in U 0213 double myAlphaV; //!< Frequency parameter in V 0214 bool myRational; //!< True if surface is rational 0215 }; 0216 0217 #endif // _GeomEval_TBezierSurface_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|