Back to home page

EIC code displayed by LXR

 
 

    


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_SurfaceOfExtrusion_HeaderFile
0015 #define _GeomGridEval_SurfaceOfExtrusion_HeaderFile
0016 
0017 #include <GeomGridEval.hxx>
0018 #include <GeomGridEval_Curve.hxx>
0019 #include <Geom_Curve.hxx>
0020 #include <Geom_SurfaceOfLinearExtrusion.hxx>
0021 #include <gp_Dir.hxx>
0022 #include <NCollection_Array1.hxx>
0023 #include <NCollection_Array2.hxx>
0024 #include <Standard.hxx>
0025 #include <Standard_DefineAlloc.hxx>
0026 
0027 //! @brief Optimized batch evaluator for linear extrusion surface grid points.
0028 //!
0029 //! Evaluates the extrusion surface formula:
0030 //! S(u, v) = C(u) + v * Direction
0031 //!
0032 //! Where:
0033 //! - C(u) is the basis curve
0034 //! - v is the extrusion parameter
0035 //! - Direction is the extrusion direction (unit vector)
0036 //!
0037 //! Optimization: Uses GeomGridEval_Curve for batch evaluation of the basis curve,
0038 //! then applies the linear shift v*Direction for each grid point.
0039 //! This is more efficient than point-by-point evaluation.
0040 //!
0041 //! Usage:
0042 //! @code
0043 //!   GeomGridEval_SurfaceOfExtrusion anEvaluator(myExtrusionSurface);
0044 //!   NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myUParams, myVParams);
0045 //! @endcode
0046 class GeomGridEval_SurfaceOfExtrusion
0047 {
0048 public:
0049   DEFINE_STANDARD_ALLOC
0050 
0051   //! Constructor with geometry.
0052   //! @param theExtrusion the extrusion surface geometry to evaluate
0053   Standard_EXPORT GeomGridEval_SurfaceOfExtrusion(
0054     const occ::handle<Geom_SurfaceOfLinearExtrusion>& theExtrusion);
0055 
0056   //! Non-copyable and non-movable.
0057   GeomGridEval_SurfaceOfExtrusion(const GeomGridEval_SurfaceOfExtrusion&)            = delete;
0058   GeomGridEval_SurfaceOfExtrusion& operator=(const GeomGridEval_SurfaceOfExtrusion&) = delete;
0059   GeomGridEval_SurfaceOfExtrusion(GeomGridEval_SurfaceOfExtrusion&&)                 = delete;
0060   GeomGridEval_SurfaceOfExtrusion& operator=(GeomGridEval_SurfaceOfExtrusion&&)      = delete;
0061 
0062   //! Returns the geometry handle.
0063   const occ::handle<Geom_SurfaceOfLinearExtrusion>& Geometry() const { return myGeom; }
0064 
0065   //! Evaluate all grid points.
0066   //! @param[in] theUParams array of U parameter values (curve parameter)
0067   //! @param[in] theVParams array of V parameter values (extrusion distance)
0068   //! @return 2D array of evaluated points (1-based indexing),
0069   //!         or empty array if geometry is null or no parameters set
0070   Standard_EXPORT NCollection_Array2<gp_Pnt> EvaluateGrid(
0071     const NCollection_Array1<double>& theUParams,
0072     const NCollection_Array1<double>& theVParams) const;
0073 
0074   //! Evaluate all grid points with first partial derivatives.
0075   //! @param[in] theUParams array of U parameter values (curve parameter)
0076   //! @param[in] theVParams array of V parameter values (extrusion distance)
0077   //! @return 2D array of SurfD1 (1-based indexing),
0078   //!         or empty array if geometry is null or no parameters set
0079   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD1> EvaluateGridD1(
0080     const NCollection_Array1<double>& theUParams,
0081     const NCollection_Array1<double>& theVParams) const;
0082 
0083   //! Evaluate all grid points with first and second partial derivatives.
0084   //! @param[in] theUParams array of U parameter values (curve parameter)
0085   //! @param[in] theVParams array of V parameter values (extrusion distance)
0086   //! @return 2D array of SurfD2 (1-based indexing),
0087   //!         or empty array if geometry is null or no parameters set
0088   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD2> EvaluateGridD2(
0089     const NCollection_Array1<double>& theUParams,
0090     const NCollection_Array1<double>& theVParams) const;
0091 
0092   //! Evaluate all grid points with derivatives up to third order.
0093   //! @param[in] theUParams array of U parameter values (curve parameter)
0094   //! @param[in] theVParams array of V parameter values (extrusion distance)
0095   //! @return 2D array of SurfD3 (1-based indexing),
0096   //!         or empty array if geometry is null or no parameters set
0097   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD3> EvaluateGridD3(
0098     const NCollection_Array1<double>& theUParams,
0099     const NCollection_Array1<double>& theVParams) const;
0100 
0101   //! Evaluate partial derivative d^(NU+NV)S/(dU^NU dV^NV) at all grid points.
0102   //! @param[in] theUParams array of U parameter values (curve parameter)
0103   //! @param[in] theVParams array of V parameter values (extrusion distance)
0104   //! @param[in] theNU derivative order in U direction
0105   //! @param[in] theNV derivative order in V direction
0106   //! @return 2D array of derivative vectors (1-based indexing)
0107   Standard_EXPORT NCollection_Array2<gp_Vec> EvaluateGridDN(
0108     const NCollection_Array1<double>& theUParams,
0109     const NCollection_Array1<double>& theVParams,
0110     int                               theNU,
0111     int                               theNV) const;
0112 
0113 private:
0114   occ::handle<Geom_SurfaceOfLinearExtrusion> myGeom;
0115   occ::handle<Geom_Curve>                    myBasisCurve;
0116   gp_Dir                                     myDirection;
0117 };
0118 
0119 #endif // _GeomGridEval_SurfaceOfExtrusion_HeaderFile