|
|
|||
File indexing completed on 2026-09-28 09:20:03
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_BSplineCurve_HeaderFile 0015 #define _Geom2dGridEval_BSplineCurve_HeaderFile 0016 0017 #include <BSplCLib_Cache.hxx> 0018 #include <Geom2d_BSplineCurve.hxx> 0019 #include <Geom2dGridEval.hxx> 0020 #include <NCollection_Array1.hxx> 0021 #include <Standard.hxx> 0022 #include <Standard_DefineAlloc.hxx> 0023 0024 //! @brief Efficient batch evaluator for 2D B-spline curve grid points. 0025 //! 0026 //! Optimizes evaluation of multiple points on a 2D B-spline curve by: 0027 //! - Pre-computing span indices for input parameters (no runtime binary search) 0028 //! - Pre-grouping parameters by span for cache-optimal iteration 0029 //! - Rebuilding cache only once per span block (not per point) 0030 //! - Using KnotSequence() from Geom2d_BSplineCurve for direct flat knot access 0031 //! 0032 //! Usage: 0033 //! @code 0034 //! Geom2dGridEval_BSplineCurve anEvaluator(myBSplineCurve2d); 0035 //! NCollection_Array1<gp_Pnt2d> aGrid = anEvaluator.EvaluateGrid(myParams); 0036 //! @endcode 0037 class Geom2dGridEval_BSplineCurve 0038 { 0039 public: 0040 DEFINE_STANDARD_ALLOC 0041 0042 //! Constructor with geometry. 0043 //! @param theCurve the 2D B-spline curve to evaluate 0044 Geom2dGridEval_BSplineCurve(const occ::handle<Geom2d_BSplineCurve>& theCurve) 0045 : myGeom(theCurve) 0046 { 0047 } 0048 0049 //! Non-copyable and non-movable. 0050 Geom2dGridEval_BSplineCurve(const Geom2dGridEval_BSplineCurve&) = delete; 0051 Geom2dGridEval_BSplineCurve& operator=(const Geom2dGridEval_BSplineCurve&) = delete; 0052 Geom2dGridEval_BSplineCurve(Geom2dGridEval_BSplineCurve&&) = delete; 0053 Geom2dGridEval_BSplineCurve& operator=(Geom2dGridEval_BSplineCurve&&) = delete; 0054 0055 //! Returns the geometry handle. 0056 const occ::handle<Geom2d_BSplineCurve>& Geometry() const { return myGeom; } 0057 0058 //! Evaluate all grid points. 0059 //! Points are evaluated in span-grouped order to minimize cache rebuilds. 0060 //! @param theParams array of parameter values 0061 //! @return array of evaluated points (1-based indexing), 0062 //! or empty array if geometry is null or no parameters 0063 Standard_EXPORT NCollection_Array1<gp_Pnt2d> 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 geometry is null or no parameters 0070 Standard_EXPORT NCollection_Array1<Geom2dGridEval::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 geometry is null or no parameters 0077 Standard_EXPORT NCollection_Array1<Geom2dGridEval::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 geometry is null or no parameters 0084 Standard_EXPORT NCollection_Array1<Geom2dGridEval::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 BSplCLib::DN. 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_Vec2d> EvaluateGridDN( 0094 const NCollection_Array1<double>& theParams, 0095 int theN) const; 0096 0097 private: 0098 occ::handle<Geom2d_BSplineCurve> myGeom; 0099 }; 0100 0101 #endif // _Geom2dGridEval_BSplineCurve_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|