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_OtherCurve_HeaderFile
0015 #define _GeomGridEval_OtherCurve_HeaderFile
0016 
0017 #include <Adaptor3d_Curve.hxx>
0018 #include <GeomGridEval.hxx>
0019 #include <NCollection_Array1.hxx>
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <functional>
0024 
0025 //! @brief Fallback evaluator for unknown curve types.
0026 //!
0027 //! Uses Adaptor3d_Curve::D0 for point-by-point evaluation.
0028 //! This is the slowest evaluator but handles any curve type.
0029 //!
0030 //! @note The curve adaptor reference must remain valid during the lifetime
0031 //!       of this evaluator. The evaluator does not take ownership.
0032 //!
0033 //! Usage:
0034 //! @code
0035 //!   GeomGridEval_OtherCurve anEvaluator(myCurveAdaptor);
0036 //!   NCollection_Array1<gp_Pnt> aGrid = anEvaluator.EvaluateGrid(myParams);
0037 //! @endcode
0038 class GeomGridEval_OtherCurve
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Constructor with curve adaptor reference.
0044   //! @param theCurve reference to curve adaptor (must remain valid)
0045   GeomGridEval_OtherCurve(const Adaptor3d_Curve& theCurve)
0046       : myCurve(theCurve)
0047   {
0048   }
0049 
0050   //! Non-copyable and non-movable.
0051   GeomGridEval_OtherCurve(const GeomGridEval_OtherCurve&)            = delete;
0052   GeomGridEval_OtherCurve& operator=(const GeomGridEval_OtherCurve&) = delete;
0053   GeomGridEval_OtherCurve(GeomGridEval_OtherCurve&&)                 = delete;
0054   GeomGridEval_OtherCurve& operator=(GeomGridEval_OtherCurve&&)      = delete;
0055 
0056   //! Returns the curve adaptor reference.
0057   const Adaptor3d_Curve& Curve() const { return myCurve.get(); }
0058 
0059   //! Evaluate all grid points.
0060   //! @param theParams array of parameter values
0061   //! @return array of evaluated points (1-based indexing),
0062   //!         or empty array if no parameters
0063   Standard_EXPORT NCollection_Array1<gp_Pnt> EvaluateGrid(
0064     const NCollection_Array1<double>& theParams) const;
0065 
0066   //! Evaluate all grid points with first derivative.
0067   //! @param theParams array of parameter values
0068   //! @return array of CurveD1 (1-based indexing),
0069   //!         or empty array if no parameters
0070   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD1> EvaluateGridD1(
0071     const NCollection_Array1<double>& theParams) const;
0072 
0073   //! Evaluate all grid points with first and second derivatives.
0074   //! @param theParams array of parameter values
0075   //! @return array of CurveD2 (1-based indexing),
0076   //!         or empty array if no parameters
0077   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD2> EvaluateGridD2(
0078     const NCollection_Array1<double>& theParams) const;
0079 
0080   //! Evaluate all grid points with first, second, and third derivatives.
0081   //! @param theParams array of parameter values
0082   //! @return array of CurveD3 (1-based indexing),
0083   //!         or empty array if no parameters
0084   Standard_EXPORT NCollection_Array1<GeomGridEval::CurveD3> EvaluateGridD3(
0085     const NCollection_Array1<double>& theParams) const;
0086 
0087   //! Evaluate Nth derivative at all grid points.
0088   //! For orders 1-3, reuses EvaluateGridD1/D2/D3.
0089   //! For orders > 3, uses adaptor DN method.
0090   //! @param theParams array of parameter values
0091   //! @param theN derivative order (N >= 1)
0092   //! @return array of derivative vectors (1-based indexing)
0093   Standard_EXPORT NCollection_Array1<gp_Vec> EvaluateGridDN(
0094     const NCollection_Array1<double>& theParams,
0095     int                               theN) const;
0096 
0097 private:
0098   std::reference_wrapper<const Adaptor3d_Curve> myCurve;
0099 };
0100 
0101 #endif // _GeomGridEval_OtherCurve_HeaderFile