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_OtherSurface_HeaderFile
0015 #define _GeomGridEval_OtherSurface_HeaderFile
0016 
0017 #include <Adaptor3d_Surface.hxx>
0018 #include <Geom_Surface.hxx>
0019 #include <GeomGridEval.hxx>
0020 #include <NCollection_Array1.hxx>
0021 #include <NCollection_Array2.hxx>
0022 #include <Standard.hxx>
0023 #include <Standard_DefineAlloc.hxx>
0024 
0025 #include <variant>
0026 
0027 //! @brief Fallback evaluator for any surface type.
0028 //!
0029 //! Uses D0/D1/D2/D3/DN methods for point-by-point evaluation. Supports both
0030 //! Adaptor3d_Surface (by pointer) and occ::handle<Geom_Surface> as input.
0031 //! This is the slowest evaluator but handles any surface type.
0032 //!
0033 //! @note When using adaptor pointer, the adaptor must remain valid
0034 //!       during the lifetime of this evaluator.
0035 //!
0036 //! Usage:
0037 //! @code
0038 //!   GeomGridEval_OtherSurface anEvaluator(&mySurfaceAdaptor);
0039 //!   NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myUParams, myVParams);
0040 //! @endcode
0041 class GeomGridEval_OtherSurface
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Constructor with surface adaptor pointer.
0047   //! @param theSurface pointer to surface adaptor (must remain valid)
0048   GeomGridEval_OtherSurface(const Adaptor3d_Surface* theSurface)
0049       : mySurface(theSurface)
0050   {
0051   }
0052 
0053   //! Constructor with geometry handle.
0054   //! @param theSurface handle to Geom_Surface
0055   GeomGridEval_OtherSurface(const occ::handle<Geom_Surface>& theSurface)
0056       : mySurface(theSurface)
0057   {
0058   }
0059 
0060   //! Non-copyable and non-movable.
0061   GeomGridEval_OtherSurface(const GeomGridEval_OtherSurface&)            = delete;
0062   GeomGridEval_OtherSurface& operator=(const GeomGridEval_OtherSurface&) = delete;
0063   GeomGridEval_OtherSurface(GeomGridEval_OtherSurface&&)                 = delete;
0064   GeomGridEval_OtherSurface& operator=(GeomGridEval_OtherSurface&&)      = delete;
0065 
0066   //! Evaluate grid points at Cartesian product of U and V parameters.
0067   //! @param theUParams array of U parameter values
0068   //! @param theVParams array of V parameter values
0069   //! @return 2D array of evaluated points (1-based indexing)
0070   Standard_EXPORT NCollection_Array2<gp_Pnt> EvaluateGrid(
0071     const NCollection_Array1<double>& theUParams,
0072     const NCollection_Array1<double>& theVParams) const;
0073 
0074   //! Evaluate grid points with first partial derivatives.
0075   //! @param theUParams array of U parameter values
0076   //! @param theVParams array of V parameter values
0077   //! @return 2D array of SurfD1 (1-based indexing)
0078   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD1> EvaluateGridD1(
0079     const NCollection_Array1<double>& theUParams,
0080     const NCollection_Array1<double>& theVParams) const;
0081 
0082   //! Evaluate grid points with first and second partial derivatives.
0083   //! @param theUParams array of U parameter values
0084   //! @param theVParams array of V parameter values
0085   //! @return 2D array of SurfD2 (1-based indexing)
0086   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD2> EvaluateGridD2(
0087     const NCollection_Array1<double>& theUParams,
0088     const NCollection_Array1<double>& theVParams) const;
0089 
0090   //! Evaluate grid points with derivatives up to third order.
0091   //! @param theUParams array of U parameter values
0092   //! @param theVParams array of V parameter values
0093   //! @return 2D array of SurfD3 (1-based indexing)
0094   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD3> EvaluateGridD3(
0095     const NCollection_Array1<double>& theUParams,
0096     const NCollection_Array1<double>& theVParams) const;
0097 
0098   //! Evaluate partial derivative at all grid points.
0099   //! @param theUParams array of U parameter values
0100   //! @param theVParams array of V parameter values
0101   //! @param theNU derivative order in U direction
0102   //! @param theNV derivative order in V direction
0103   //! @return 2D array of derivative vectors (1-based indexing)
0104   Standard_EXPORT NCollection_Array2<gp_Vec> EvaluateGridDN(
0105     const NCollection_Array1<double>& theUParams,
0106     const NCollection_Array1<double>& theVParams,
0107     int                               theNU,
0108     int                               theNV) const;
0109 
0110 private:
0111   //! Evaluate D0 at given UV parameters.
0112   void evaluateD0(double theU, double theV, gp_Pnt& thePoint) const;
0113 
0114   //! Evaluate D1 at given UV parameters.
0115   void evaluateD1(double theU, double theV, gp_Pnt& thePoint, gp_Vec& theD1U, gp_Vec& theD1V) const;
0116 
0117   //! Evaluate D2 at given UV parameters.
0118   void evaluateD2(double  theU,
0119                   double  theV,
0120                   gp_Pnt& thePoint,
0121                   gp_Vec& theD1U,
0122                   gp_Vec& theD1V,
0123                   gp_Vec& theD2U,
0124                   gp_Vec& theD2V,
0125                   gp_Vec& theD2UV) const;
0126 
0127   //! Evaluate D3 at given UV parameters.
0128   void evaluateD3(double  theU,
0129                   double  theV,
0130                   gp_Pnt& thePoint,
0131                   gp_Vec& theD1U,
0132                   gp_Vec& theD1V,
0133                   gp_Vec& theD2U,
0134                   gp_Vec& theD2V,
0135                   gp_Vec& theD2UV,
0136                   gp_Vec& theD3U,
0137                   gp_Vec& theD3V,
0138                   gp_Vec& theD3UUV,
0139                   gp_Vec& theD3UVV) const;
0140 
0141   //! Evaluate DN at given UV parameters.
0142   gp_Vec evaluateDN(double theU, double theV, int theNU, int theNV) const;
0143 
0144 private:
0145   //! Surface source: either adaptor pointer or geometry handle.
0146   std::variant<const Adaptor3d_Surface*, occ::handle<Geom_Surface>> mySurface;
0147 };
0148 
0149 #endif // _GeomGridEval_OtherSurface_HeaderFile