|
|
|||
File indexing completed on 2026-09-16 09:17:03
0001 // Created on: 1994-03-23 0002 // Created by: Bruno DUMORTIER 0003 // Copyright (c) 1994-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Geom2dAPI_PointsToBSpline_HeaderFile 0018 #define _Geom2dAPI_PointsToBSpline_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <gp_Pnt2d.hxx> 0025 #include <NCollection_Array1.hxx> 0026 #include <Standard_Integer.hxx> 0027 #include <GeomAbs_Shape.hxx> 0028 #include <Approx_ParametrizationType.hxx> 0029 class Geom2d_BSplineCurve; 0030 0031 //! This class is used to approximate a BsplineCurve 0032 //! passing through an array of points, with a given 0033 //! Continuity. 0034 //! Describes functions for building a 2D BSpline 0035 //! curve which approximates a set of points. 0036 //! A PointsToBSpline object provides a framework for: 0037 //! - defining the data of the BSpline curve to be built, 0038 //! - implementing the approximation algorithm, and 0039 //! - consulting the results 0040 class Geom2dAPI_PointsToBSpline 0041 { 0042 public: 0043 DEFINE_STANDARD_ALLOC 0044 0045 //! Constructs an empty approximation algorithm. 0046 //! Use an Init function to define and build the BSpline curve. 0047 Standard_EXPORT Geom2dAPI_PointsToBSpline(); 0048 0049 //! Approximate a BSpline Curve passing through an 0050 //! array of Point. The resulting BSpline will have 0051 //! the following properties: 0052 //! 1- his degree will be in the range [Degmin,Degmax] 0053 //! 2- his continuity will be at least <Continuity> 0054 //! 3- the distance from the point <Points> to the 0055 //! BSpline will be lower to Tol2D 0056 Standard_EXPORT Geom2dAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt2d>& Points, 0057 const int DegMin = 3, 0058 const int DegMax = 8, 0059 const GeomAbs_Shape Continuity = GeomAbs_C2, 0060 const double Tol2D = 1.0e-6); 0061 0062 //! Approximate a BSpline Curve passing through an 0063 //! array of Point. Of coordinates : 0064 //! 0065 //! X = X0 + DX * (i-YValues.Lower()) 0066 //! Y = YValues(i) 0067 //! 0068 //! With i in the range YValues.Lower(), YValues.Upper() 0069 //! 0070 //! The BSpline will be parametrized from t = X0 to 0071 //! X0 + DX * (YValues.Upper() - YValues.Lower()) 0072 //! 0073 //! And will satisfy X(t) = t 0074 //! 0075 //! The resulting BSpline will have 0076 //! the following properties: 0077 //! 1- his degree will be in the range [Degmin,Degmax] 0078 //! 2- his continuity will be at least <Continuity> 0079 //! 3- the distance from the point <Points> to the 0080 //! BSpline will be lower to Tol2D 0081 Standard_EXPORT Geom2dAPI_PointsToBSpline(const NCollection_Array1<double>& YValues, 0082 const double X0, 0083 const double DX, 0084 const int DegMin = 3, 0085 const int DegMax = 8, 0086 const GeomAbs_Shape Continuity = GeomAbs_C2, 0087 const double Tol2D = 1.0e-6); 0088 0089 //! Approximate a BSpline Curve passing through an 0090 //! array of Point. The resulting BSpline will have 0091 //! the following properties: 0092 //! 1- his degree will be in the range [Degmin,Degmax] 0093 //! 2- his continuity will be at least <Continuity> 0094 //! 3- the distance from the point <Points> to the 0095 //! BSpline will be lower to Tol2D 0096 Standard_EXPORT Geom2dAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt2d>& Points, 0097 const Approx_ParametrizationType ParType, 0098 const int DegMin = 3, 0099 const int DegMax = 8, 0100 const GeomAbs_Shape Continuity = GeomAbs_C2, 0101 const double Tol2D = 1.0e-3); 0102 0103 //! Approximate a BSpline Curve passing through an 0104 //! array of Point, which parameters are given by the 0105 //! array <Parameters>. 0106 //! The resulting BSpline will have the following 0107 //! properties: 0108 //! 1- his degree will be in the range [Degmin,Degmax] 0109 //! 2- his continuity will be at least <Continuity> 0110 //! 3- the distance from the point <Points> to the 0111 //! BSpline will be lower to Tol2D 0112 Standard_EXPORT Geom2dAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt2d>& Points, 0113 const NCollection_Array1<double>& Parameters, 0114 const int DegMin = 3, 0115 const int DegMax = 8, 0116 const GeomAbs_Shape Continuity = GeomAbs_C2, 0117 const double Tol2D = 1.0e-3); 0118 0119 //! Approximate a BSpline Curve passing through an 0120 //! array of Point using variational smoothing algorithm, 0121 //! which tries to minimize additional criterium: 0122 //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion 0123 Standard_EXPORT Geom2dAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt2d>& Points, 0124 const double Weight1, 0125 const double Weight2, 0126 const double Weight3, 0127 const int DegMax = 8, 0128 const GeomAbs_Shape Continuity = GeomAbs_C2, 0129 const double Tol3D = 1.0e-3); 0130 0131 //! Approximate a BSpline Curve passing through an 0132 //! array of Point. The resulting BSpline will have 0133 //! the following properties: 0134 //! 1- his degree will be in the range [Degmin,Degmax] 0135 //! 2- his continuity will be at least <Continuity> 0136 //! 3- the distance from the point <Points> to the 0137 //! BSpline will be lower to Tol2D 0138 Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt2d>& Points, 0139 const int DegMin = 3, 0140 const int DegMax = 8, 0141 const GeomAbs_Shape Continuity = GeomAbs_C2, 0142 const double Tol2D = 1.0e-6); 0143 0144 //! Approximate a BSpline Curve passing through an 0145 //! array of Point. Of coordinates : 0146 //! 0147 //! X = X0 + DX * (i-YValues.Lower()) 0148 //! Y = YValues(i) 0149 //! 0150 //! With i in the range YValues.Lower(), YValues.Upper() 0151 //! 0152 //! The BSpline will be parametrized from t = X0 to 0153 //! X0 + DX * (YValues.Upper() - YValues.Lower()) 0154 //! 0155 //! And will satisfy X(t) = t 0156 //! 0157 //! The resulting BSpline will have 0158 //! the following properties: 0159 //! 1- his degree will be in the range [Degmin,Degmax] 0160 //! 2- his continuity will be at least <Continuity> 0161 //! 3- the distance from the point <Points> to the 0162 //! BSpline will be lower to Tol2D 0163 Standard_EXPORT void Init(const NCollection_Array1<double>& YValues, 0164 const double X0, 0165 const double DX, 0166 const int DegMin = 3, 0167 const int DegMax = 8, 0168 const GeomAbs_Shape Continuity = GeomAbs_C2, 0169 const double Tol2D = 1.0e-6); 0170 0171 //! Approximate a BSpline Curve passing through an 0172 //! array of Point. The resulting BSpline will have 0173 //! the following properties: 0174 //! 1- his degree will be in the range [Degmin,Degmax] 0175 //! 2- his continuity will be at least <Continuity> 0176 //! 3- the distance from the point <Points> to the 0177 //! BSpline will be lower to Tol2D 0178 Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt2d>& Points, 0179 const Approx_ParametrizationType ParType, 0180 const int DegMin = 3, 0181 const int DegMax = 8, 0182 const GeomAbs_Shape Continuity = GeomAbs_C2, 0183 const double Tol2D = 1.0e-3); 0184 0185 //! Approximate a BSpline Curve passing through an 0186 //! array of Point, which parameters are given by the 0187 //! array <Parameters>. 0188 //! The resulting BSpline will have the following 0189 //! properties: 0190 //! 1- his degree will be in the range [Degmin,Degmax] 0191 //! 2- his continuity will be at least <Continuity> 0192 //! 3- the distance from the point <Points> to the 0193 //! BSpline will be lower to Tol2D 0194 Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt2d>& Points, 0195 const NCollection_Array1<double>& Parameters, 0196 const int DegMin = 3, 0197 const int DegMax = 8, 0198 const GeomAbs_Shape Continuity = GeomAbs_C2, 0199 const double Tol2D = 1.0e-3); 0200 0201 //! Approximate a BSpline Curve passing through an 0202 //! array of Point using variational smoothing algorithm, 0203 //! which tries to minimize additional criterium: 0204 //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion 0205 Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt2d>& Points, 0206 const double Weight1, 0207 const double Weight2, 0208 const double Weight3, 0209 const int DegMax = 8, 0210 const GeomAbs_Shape Continuity = GeomAbs_C2, 0211 const double Tol2D = 1.0e-3); 0212 0213 //! Returns the approximate BSpline Curve 0214 Standard_EXPORT const occ::handle<Geom2d_BSplineCurve>& Curve() const; 0215 Standard_EXPORT operator occ::handle<Geom2d_BSplineCurve>() const; 0216 0217 Standard_EXPORT bool IsDone() const; 0218 0219 private: 0220 bool myIsDone; 0221 occ::handle<Geom2d_BSplineCurve> myCurve; 0222 }; 0223 0224 #endif // _Geom2dAPI_PointsToBSpline_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|