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_BezierSurface_HeaderFile
0015 #define _GeomGridEval_BezierSurface_HeaderFile
0016 
0017 #include <BSplSLib_Cache.hxx>
0018 #include <Geom_BezierSurface.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 Efficient batch evaluator for Bezier surface grid points.
0026 //!
0027 //! Uses BSplSLib_Cache for optimized polynomial evaluation.
0028 //! Bezier surfaces are treated as single-span B-spline surfaces.
0029 //!
0030 //! Usage:
0031 //! @code
0032 //!   GeomGridEval_BezierSurface anEvaluator(myGeomBezier);
0033 //!   NCollection_Array2<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myUParams, myVParams);
0034 //! @endcode
0035 class GeomGridEval_BezierSurface
0036 {
0037 public:
0038   DEFINE_STANDARD_ALLOC
0039 
0040   //! Constructor with geometry.
0041   //! @param theBezier the bezier surface geometry to evaluate
0042   GeomGridEval_BezierSurface(const occ::handle<Geom_BezierSurface>& theBezier)
0043       : myGeom(theBezier)
0044   {
0045   }
0046 
0047   //! Non-copyable and non-movable.
0048   GeomGridEval_BezierSurface(const GeomGridEval_BezierSurface&)            = delete;
0049   GeomGridEval_BezierSurface& operator=(const GeomGridEval_BezierSurface&) = delete;
0050   GeomGridEval_BezierSurface(GeomGridEval_BezierSurface&&)                 = delete;
0051   GeomGridEval_BezierSurface& operator=(GeomGridEval_BezierSurface&&)      = delete;
0052 
0053   //! Returns the geometry handle.
0054   const occ::handle<Geom_BezierSurface>& Geometry() const { return myGeom; }
0055 
0056   //! Evaluate all grid points.
0057   //! @param[in] theUParams array of U parameter values
0058   //! @param[in] theVParams array of V parameter values
0059   //! @return 2D array of evaluated points (1-based indexing),
0060   //!         or empty array if geometry is null or no parameters set
0061   Standard_EXPORT NCollection_Array2<gp_Pnt> EvaluateGrid(
0062     const NCollection_Array1<double>& theUParams,
0063     const NCollection_Array1<double>& theVParams) const;
0064 
0065   //! Evaluate all grid points with first partial derivatives.
0066   //! @param[in] theUParams array of U parameter values
0067   //! @param[in] theVParams array of V parameter values
0068   //! @return 2D array of SurfD1 (1-based indexing),
0069   //!         or empty array if geometry is null or no parameters set
0070   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD1> EvaluateGridD1(
0071     const NCollection_Array1<double>& theUParams,
0072     const NCollection_Array1<double>& theVParams) const;
0073 
0074   //! Evaluate all grid points with first and second 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 SurfD2 (1-based indexing),
0078   //!         or empty array if geometry is null or no parameters set
0079   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD2> EvaluateGridD2(
0080     const NCollection_Array1<double>& theUParams,
0081     const NCollection_Array1<double>& theVParams) const;
0082 
0083   //! Evaluate all grid points with derivatives up to third order.
0084   //! Uses direct Geom_BezierSurface::D3 evaluation.
0085   //! @param[in] theUParams array of U parameter values
0086   //! @param[in] theVParams array of V parameter values
0087   //! @return 2D array of SurfD3 (1-based indexing),
0088   //!         or empty array if geometry is null or no parameters set
0089   Standard_EXPORT NCollection_Array2<GeomGridEval::SurfD3> EvaluateGridD3(
0090     const NCollection_Array1<double>& theUParams,
0091     const NCollection_Array1<double>& theVParams) const;
0092 
0093   //! Evaluate partial derivative d^(NU+NV)S/(dU^NU dV^NV) at all grid points.
0094   //! For orders 1-3, reuses EvaluateGridD1/D2/D3.
0095   //! For orders > 3, uses geometry DN method.
0096   //! @param[in] theUParams array of U parameter values
0097   //! @param[in] theVParams array of V parameter values
0098   //! @param[in] theNU derivative order in U direction
0099   //! @param[in] theNV derivative order in V direction
0100   //! @return 2D array of derivative vectors (1-based indexing)
0101   Standard_EXPORT NCollection_Array2<gp_Vec> EvaluateGridDN(
0102     const NCollection_Array1<double>& theUParams,
0103     const NCollection_Array1<double>& theVParams,
0104     int                               theNU,
0105     int                               theNV) const;
0106 
0107 private:
0108   occ::handle<Geom_BezierSurface> myGeom;
0109 };
0110 
0111 #endif // _GeomGridEval_BezierSurface_HeaderFile