|
|
|||
File indexing completed on 2026-09-28 09:20:11
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 _GeomGridEval_Cone_HeaderFile 0015 #define _GeomGridEval_Cone_HeaderFile 0016 0017 #include <Geom_ConicalSurface.hxx> 0018 #include <GeomGridEval.hxx> 0019 #include <gp_Pnt2d.hxx> 0020 #include <NCollection_Array1.hxx> 0021 #include <NCollection_Array2.hxx> 0022 #include <Standard.hxx> 0023 #include <Standard_DefineAlloc.hxx> 0024 0025 //! @brief Efficient batch evaluator for cone grid points. 0026 //! 0027 //! Uses analytical formula: 0028 //! P(u,v) = Location + (RefRadius + v * sin(SemiAngle)) * (cos(u) * XDir + sin(u) * YDir) + v * 0029 //! cos(SemiAngle) * ZDir 0030 //! 0031 //! Where U is angle (0 to 2*PI) and V is linear parameter along the ruling. 0032 //! 0033 //! Usage: 0034 //! @code 0035 //! GeomGridEval_Cone anEvaluator(myGeomCone); 0036 //! NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myUParams, myVParams); 0037 //! @endcode 0038 class GeomGridEval_Cone 0039 { 0040 public: 0041 DEFINE_STANDARD_ALLOC 0042 0043 //! Constructor with geometry. 0044 //! @param theCone the conical surface geometry to evaluate 0045 GeomGridEval_Cone(const occ::handle<Geom_ConicalSurface>& theCone) 0046 : myGeom(theCone) 0047 { 0048 } 0049 0050 //! Non-copyable and non-movable. 0051 GeomGridEval_Cone(const GeomGridEval_Cone&) = delete; 0052 GeomGridEval_Cone& operator=(const GeomGridEval_Cone&) = delete; 0053 GeomGridEval_Cone(GeomGridEval_Cone&&) = delete; 0054 GeomGridEval_Cone& operator=(GeomGridEval_Cone&&) = delete; 0055 0056 //! Returns the geometry handle. 0057 const occ::handle<Geom_ConicalSurface>& Geometry() const { return myGeom; } 0058 0059 //! Evaluate grid points at Cartesian product of U and V parameters. 0060 //! @param theUParams array of U parameter values (angle) 0061 //! @param theVParams array of V parameter values (linear along ruling) 0062 //! @return 2D array of evaluated points (1-based indexing) 0063 Standard_EXPORT NCollection_Array2<gp_Pnt> EvaluateGrid( 0064 const NCollection_Array1<double>& theUParams, 0065 const NCollection_Array1<double>& theVParams) const; 0066 0067 //! Evaluate grid points with first partial derivatives. 0068 //! @param theUParams array of U parameter values (angle) 0069 //! @param theVParams array of V parameter values (linear along ruling) 0070 //! @return 2D array of SurfD1 (1-based indexing) 0071 Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD1> EvaluateGridD1( 0072 const NCollection_Array1<double>& theUParams, 0073 const NCollection_Array1<double>& theVParams) const; 0074 0075 //! Evaluate grid points with first and second partial derivatives. 0076 //! @param theUParams array of U parameter values (angle) 0077 //! @param theVParams array of V parameter values (linear along ruling) 0078 //! @return 2D array of SurfD2 (1-based indexing) 0079 Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD2> EvaluateGridD2( 0080 const NCollection_Array1<double>& theUParams, 0081 const NCollection_Array1<double>& theVParams) const; 0082 0083 //! Evaluate grid points with derivatives up to third order. 0084 //! @param theUParams array of U parameter values (angle) 0085 //! @param theVParams array of V parameter values (linear along ruling) 0086 //! @return 2D array of SurfD3 (1-based indexing) 0087 Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD3> EvaluateGridD3( 0088 const NCollection_Array1<double>& theUParams, 0089 const NCollection_Array1<double>& theVParams) const; 0090 0091 //! Evaluate partial derivative d^(NU+NV)S/(dU^NU dV^NV) at all grid points. 0092 //! For orders 1-3, reuses EvaluateGridD1/D2/D3. 0093 //! For orders > 3, uses geometry DN method. 0094 //! @param theUParams array of U parameter values (angle) 0095 //! @param theVParams array of V parameter values (linear along ruling) 0096 //! @param theNU derivative order in U direction 0097 //! @param theNV derivative order in V direction 0098 //! @return 2D array of derivative vectors (1-based indexing) 0099 Standard_EXPORT NCollection_Array2<gp_Vec> EvaluateGridDN( 0100 const NCollection_Array1<double>& theUParams, 0101 const NCollection_Array1<double>& theVParams, 0102 int theNU, 0103 int theNV) const; 0104 0105 private: 0106 //! Pre-extracted cone data for efficient evaluation. 0107 struct Data 0108 { 0109 double CX, CY, CZ; //!< Center coordinates 0110 double XX, XY, XZ; //!< XDir coordinates 0111 double YX, YY, YZ; //!< YDir coordinates 0112 double ZX, ZY, ZZ; //!< ZDir coordinates 0113 double RefRadius; //!< Reference radius 0114 double SinAng; //!< sin(SemiAngle) 0115 double CosAng; //!< cos(SemiAngle) 0116 }; 0117 0118 //! Pre-computed U-dependent values for optimized grid evaluation. 0119 struct UContext 0120 { 0121 double cosU, sinU; 0122 double dirUX, dirUY, dirUZ; //!< DirU = cosU*XDir + sinU*YDir 0123 double dDirUX, dDirUY, dDirUZ; //!< DerivDirU = -sinU*XDir + cosU*YDir 0124 }; 0125 0126 //! Extract cone data for evaluation. 0127 Data extractData() const; 0128 0129 //! Pre-compute U-dependent values. 0130 static UContext computeUContext(const Data& theData, double theU); 0131 0132 //! Compute point with pre-computed U context. 0133 static gp_Pnt computeD0(const Data& theData, const UContext& theUCtx, double theV); 0134 0135 //! Compute point with D1 with pre-computed U context. 0136 static GeomGridEval::SurfD1 computeD1(const Data& theData, const UContext& theUCtx, double theV); 0137 0138 //! Compute point with D2 with pre-computed U context. 0139 static GeomGridEval::SurfD2 computeD2(const Data& theData, const UContext& theUCtx, double theV); 0140 0141 //! Compute point with D3 with pre-computed U context. 0142 static GeomGridEval::SurfD3 computeD3(const Data& theData, const UContext& theUCtx, double theV); 0143 0144 //! Compute DN with pre-computed U context. 0145 static gp_Vec computeDN(const Data& theData, 0146 const UContext& theUCtx, 0147 double theV, 0148 int theNU, 0149 int theNV); 0150 0151 occ::handle<Geom_ConicalSurface> myGeom; 0152 }; 0153 0154 #endif // _GeomGridEval_Cone_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|