Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:20:04

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 _Geom2dGridEval_Parabola_HeaderFile
0015 #define _Geom2dGridEval_Parabola_HeaderFile
0016 
0017 #include <Geom2d_Parabola.hxx>
0018 #include <Geom2dGridEval.hxx>
0019 #include <NCollection_Array1.hxx>
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 //! @brief Efficient batch evaluator for 2D parabola grid points.
0024 //!
0025 //! Uses analytical formula:
0026 //! P(u) = Center + (u^2 / (4*Focal)) * XDir + u * YDir
0027 //!
0028 //! Usage:
0029 //! @code
0030 //!   Geom2dGridEval_Parabola anEvaluator(myGeom2dParabola);
0031 //!   NCollection_Array1<gp_Pnt2d> aGrid = anEvaluator.EvaluateGrid(myParams);
0032 //! @endcode
0033 class Geom2dGridEval_Parabola
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Constructor with geometry.
0039   //! @param theParabola the 2D parabola geometry to evaluate
0040   Geom2dGridEval_Parabola(const occ::handle<Geom2d_Parabola>& theParabola)
0041       : myGeom(theParabola)
0042   {
0043   }
0044 
0045   //! Non-copyable and non-movable.
0046   Geom2dGridEval_Parabola(const Geom2dGridEval_Parabola&)            = delete;
0047   Geom2dGridEval_Parabola& operator=(const Geom2dGridEval_Parabola&) = delete;
0048   Geom2dGridEval_Parabola(Geom2dGridEval_Parabola&&)                 = delete;
0049   Geom2dGridEval_Parabola& operator=(Geom2dGridEval_Parabola&&)      = delete;
0050 
0051   //! Returns the geometry handle.
0052   const occ::handle<Geom2d_Parabola>& 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_Pnt2d> 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<Geom2dGridEval::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<Geom2dGridEval::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<Geom2dGridEval::CurveD3> EvaluateGridD3(
0077     const NCollection_Array1<double>& theParams) const;
0078 
0079   //! Evaluate Nth derivative at all grid points.
0080   //! Parabola: P = Center + (u^2/4F) * X + u * Y
0081   //! D1 = (u/2F) * X + Y (depends on u)
0082   //! D2 = (1/2F) * X (constant)
0083   //! DN = 0 for N >= 3
0084   //! @param theParams array of parameter values
0085   //! @param theN derivative order (N >= 1)
0086   //! @return array of derivative vectors (1-based indexing)
0087   Standard_EXPORT NCollection_Array1<gp_Vec2d> EvaluateGridDN(
0088     const NCollection_Array1<double>& theParams,
0089     int                               theN) const;
0090 
0091 private:
0092   occ::handle<Geom2d_Parabola> myGeom;
0093 };
0094 
0095 #endif // _Geom2dGridEval_Parabola_HeaderFile