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_BezierCurve_HeaderFile
0015 #define _GeomGridEval_BezierCurve_HeaderFile
0016 
0017 #include <BSplCLib_Cache.hxx>
0018 #include <Geom_BezierCurve.hxx>
0019 #include <GeomGridEval.hxx>
0020 #include <NCollection_Array1.hxx>
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 
0024 //! @brief Efficient batch evaluator for Bezier curve grid points.
0025 //!
0026 //! Uses BSplCLib to evaluate Bezier curves (treated as B-Splines).
0027 //!
0028 //! Usage:
0029 //! @code
0030 //!   GeomGridEval_BezierCurve anEvaluator(myGeomBezier);
0031 //!   NCollection_Array1<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myParams);
0032 //! @endcode
0033 class GeomGridEval_BezierCurve
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Constructor with geometry.
0039   //! @param theBezier the bezier curve geometry to evaluate
0040   GeomGridEval_BezierCurve(const occ::handle<Geom_BezierCurve>& theBezier)
0041       : myGeom(theBezier)
0042   {
0043   }
0044 
0045   //! Non-copyable and non-movable.
0046   GeomGridEval_BezierCurve(const GeomGridEval_BezierCurve&)            = delete;
0047   GeomGridEval_BezierCurve& operator=(const GeomGridEval_BezierCurve&) = delete;
0048   GeomGridEval_BezierCurve(GeomGridEval_BezierCurve&&)                 = delete;
0049   GeomGridEval_BezierCurve& operator=(GeomGridEval_BezierCurve&&)      = delete;
0050 
0051   //! Returns the geometry handle.
0052   const occ::handle<Geom_BezierCurve>& Geometry() const { return myGeom; }
0053 
0054   //! Evaluate all grid points.
0055   //! @param theParams array of parameter values
0056   //! @return array of evaluated points (1-based indexing),
0057   //!         or empty array if geometry is null or no parameters
0058   Standard_EXPORT NCollection_Array1<gp_Pnt> EvaluateGrid(
0059     const NCollection_Array1<double>& theParams) const;
0060 
0061   //! Evaluate all grid points with first derivative.
0062   //! @param theParams array of parameter values
0063   //! @return array of CurveD1 (1-based indexing)
0064   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD1> EvaluateGridD1(
0065     const NCollection_Array1<double>& theParams) const;
0066 
0067   //! Evaluate all grid points with first and second derivatives.
0068   //! @param theParams array of parameter values
0069   //! @return array of CurveD2 (1-based indexing)
0070   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD2> EvaluateGridD2(
0071     const NCollection_Array1<double>& theParams) const;
0072 
0073   //! Evaluate all grid points with first, second, and third derivatives.
0074   //! @param theParams array of parameter values
0075   //! @return array of CurveD3 (1-based indexing)
0076   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD3> EvaluateGridD3(
0077     const NCollection_Array1<double>& theParams) const;
0078 
0079   //! Evaluate Nth derivative at all grid points.
0080   //! For orders 1-3, reuses EvaluateGridD1/D2/D3.
0081   //! For orders > 3, uses BSplCLib::DN.
0082   //! @param theParams array of parameter values
0083   //! @param theN derivative order (N >= 1)
0084   //! @return array of derivative vectors (1-based indexing)
0085   Standard_EXPORT NCollection_Array1<gp_Vec> EvaluateGridDN(
0086     const NCollection_Array1<double>& theParams,
0087     int                               theN) const;
0088 
0089 private:
0090   occ::handle<Geom_BezierCurve> myGeom;
0091 };
0092 
0093 #endif // _GeomGridEval_BezierCurve_HeaderFile