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_OffsetSurface_HeaderFile
0015 #define _GeomGridEval_OffsetSurface_HeaderFile
0016 
0017 #include <Geom_OffsetSurface.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 //! @brief Batch evaluator for offset surface grid points.
0026 //!
0027 //! Evaluates the offset surface formula:
0028 //! P(u,v) = S(u,v) + Offset * Normal(u,v)
0029 //!
0030 //! Uses GeomGridEval_Surface for batch evaluation of the basis surface,
0031 //! then applies offset transformation.
0032 //!
0033 //! Usage:
0034 //! @code
0035 //!   GeomGridEval_OffsetSurface anEvaluator(myGeomOffset);
0036 //!   NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myUParams, myVParams);
0037 //! @endcode
0038 class GeomGridEval_OffsetSurface
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Constructor with geometry.
0044   //! @param theOffset the offset surface geometry to evaluate
0045   GeomGridEval_OffsetSurface(const occ::handle<Geom_OffsetSurface>& theOffset)
0046       : myGeom(theOffset),
0047         myOffset(0.0)
0048   {
0049     if (!myGeom.IsNull())
0050     {
0051       myOffset = myGeom->Offset();
0052       myBasis  = myGeom->BasisSurface();
0053     }
0054   }
0055 
0056   //! Non-copyable and non-movable.
0057   GeomGridEval_OffsetSurface(const GeomGridEval_OffsetSurface&)            = delete;
0058   GeomGridEval_OffsetSurface& operator=(const GeomGridEval_OffsetSurface&) = delete;
0059   GeomGridEval_OffsetSurface(GeomGridEval_OffsetSurface&&)                 = delete;
0060   GeomGridEval_OffsetSurface& operator=(GeomGridEval_OffsetSurface&&)      = delete;
0061 
0062   //! Returns the geometry handle.
0063   const occ::handle<Geom_OffsetSurface>& Geometry() const { return myGeom; }
0064 
0065   //! Evaluate all grid points.
0066   //! @param[in] theUParams array of U parameter values
0067   //! @param[in] theVParams array of V parameter values
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
0076   //! @param[in] theVParams array of V parameter values
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
0085   //! @param[in] theVParams array of V parameter values
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   //! Uses GeomAdaptor_Surface::D3 for evaluation.
0094   //! @param[in] theUParams array of U parameter values
0095   //! @param[in] theVParams array of V parameter values
0096   //! @return 2D array of SurfD3 (1-based indexing),
0097   //!         or empty array if geometry is null or no parameters set
0098   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD3> EvaluateGridD3(
0099     const NCollection_Array1<double>& theUParams,
0100     const NCollection_Array1<double>& theVParams) const;
0101 
0102   //! Evaluate partial derivative d^(NU+NV)S/(dU^NU dV^NV) at all grid points.
0103   //! Uses geometry DN method.
0104   //! @param[in] theUParams array of U parameter values
0105   //! @param[in] theVParams array of V parameter values
0106   //! @param[in] theNU derivative order in U direction
0107   //! @param[in] theNV derivative order in V direction
0108   //! @return 2D array of derivative vectors (1-based indexing)
0109   Standard_EXPORT NCollection_Array2<gp_Vec> EvaluateGridDN(
0110     const NCollection_Array1<double>& theUParams,
0111     const NCollection_Array1<double>& theVParams,
0112     int                               theNU,
0113     int                               theNV) const;
0114 
0115 private:
0116   occ::handle<Geom_OffsetSurface> myGeom;
0117   occ::handle<Geom_Surface>       myBasis;
0118   double                          myOffset;
0119 };
0120 
0121 #endif // _GeomGridEval_OffsetSurface_HeaderFile