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_Circle_HeaderFile
0015 #define _GeomGridEval_Circle_HeaderFile
0016 
0017 #include <Geom_Circle.hxx>
0018 #include <GeomGridEval.hxx>
0019 #include <NCollection_Array1.hxx>
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 //! @brief Efficient batch evaluator for circle grid points.
0024 //!
0025 //! Uses analytical formula: P(u) = Center + R * (cos(u) * XDir + sin(u) * YDir)
0026 //!
0027 //! Usage:
0028 //! @code
0029 //!   GeomGridEval_Circle anEvaluator(myGeomCircle);
0030 //!   NCollection_Array1<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myParams);
0031 //! @endcode
0032 class GeomGridEval_Circle
0033 {
0034 public:
0035   DEFINE_STANDARD_ALLOC
0036 
0037   //! Constructor with geometry.
0038   //! @param theCircle the circle geometry to evaluate
0039   GeomGridEval_Circle(const occ::handle<Geom_Circle>& theCircle)
0040       : myGeom(theCircle)
0041   {
0042   }
0043 
0044   //! Non-copyable and non-movable.
0045   GeomGridEval_Circle(const GeomGridEval_Circle&)            = delete;
0046   GeomGridEval_Circle& operator=(const GeomGridEval_Circle&) = delete;
0047   GeomGridEval_Circle(GeomGridEval_Circle&&)                 = delete;
0048   GeomGridEval_Circle& operator=(GeomGridEval_Circle&&)      = delete;
0049 
0050   //! Returns the geometry handle.
0051   const occ::handle<Geom_Circle>& Geometry() const { return myGeom; }
0052 
0053   //! Evaluate all grid points.
0054   //! @param theParams array of parameter values (angles in radians)
0055   //! @return array of evaluated points (1-based indexing),
0056   //!         or empty array if geometry is null or no parameters
0057   Standard_EXPORT NCollection_Array1<gp_Pnt> EvaluateGrid(
0058     const NCollection_Array1<double>& theParams) const;
0059 
0060   //! Evaluate all grid points with first derivative.
0061   //! D1 = R * (-sin(u) * XDir + cos(u) * YDir)
0062   //! @param theParams array of parameter values
0063   //! @return array of CurveD1 (1-based indexing),
0064   //!         or empty array if geometry is null or no parameters
0065   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD1> EvaluateGridD1(
0066     const NCollection_Array1<double>& theParams) const;
0067 
0068   //! Evaluate all grid points with first and second derivatives.
0069   //! D2 = R * (-cos(u) * XDir - sin(u) * YDir) = -P (relative to center)
0070   //! @param theParams array of parameter values
0071   //! @return array of CurveD2 (1-based indexing),
0072   //!         or empty array if geometry is null or no parameters
0073   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD2> EvaluateGridD2(
0074     const NCollection_Array1<double>& theParams) const;
0075 
0076   //! Evaluate all grid points with first, second, and third derivatives.
0077   //! D3 = R * (sin(u) * XDir - cos(u) * YDir) = -D1
0078   //! @param theParams array of parameter values
0079   //! @return array of CurveD3 (1-based indexing),
0080   //!         or empty array if geometry is null or no parameters
0081   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD3> EvaluateGridD3(
0082     const NCollection_Array1<double>& theParams) const;
0083 
0084   //! Evaluate Nth derivative at all grid points.
0085   //! Circle has cyclic derivatives with period 4:
0086   //! D1 = R * (-sin(u) * X + cos(u) * Y)
0087   //! D2 = R * (-cos(u) * X - sin(u) * Y)
0088   //! D3 = R * (sin(u) * X - cos(u) * Y)
0089   //! D4 = R * (cos(u) * X + sin(u) * Y) = D0, then repeats
0090   //! @param theParams array of parameter values
0091   //! @param theN derivative order (N >= 1)
0092   //! @return array of derivative vectors (1-based indexing),
0093   //!         or empty array if geometry is null or no parameters
0094   Standard_EXPORT NCollection_Array1<gp_Vec> EvaluateGridDN(
0095     const NCollection_Array1<double>& theParams,
0096     int                               theN) const;
0097 
0098 private:
0099   occ::handle<Geom_Circle> myGeom;
0100 };
0101 
0102 #endif // _GeomGridEval_Circle_HeaderFile