|
|
|||
File indexing completed on 2026-10-05 09:22:04
0001 // Created on: 1996-11-08 0002 // Created by: Jean Claude VAUTHIER 0003 // Copyright (c) 1996-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 _GCPnts_TangentialDeflection_HeaderFile 0018 #define _GCPnts_TangentialDeflection_HeaderFile 0019 0020 #include <gp_Pnt.hxx> 0021 #include <NCollection_Sequence.hxx> 0022 #include <math_Function.hxx> 0023 #include <math_MultipleVarFunction.hxx> 0024 #include <Adaptor3d_Curve.hxx> 0025 #include <Adaptor2d_Curve2d.hxx> 0026 0027 //! Computes a set of points on a curve from package 0028 //! Adaptor3d such as between two successive points 0029 //! P1(u1)and P2(u2) : 0030 //! @code 0031 //! . ||P1P3^P3P2||/||P1P3||*||P3P2||<AngularDeflection 0032 //! . ||P1P2^P1P3||/||P1P2||<CurvatureDeflection 0033 //! @endcode 0034 //! where P3 is the point of abscissa ((u1+u2)/2), with 0035 //! u1 the abscissa of the point P1 and u2 the abscissa 0036 //! of the point P2. 0037 //! 0038 //! ^ is the cross product of two vectors, and ||P1P2|| 0039 //! the magnitude of the vector P1P2. 0040 //! 0041 //! The conditions AngularDeflection > gp::Resolution() 0042 //! and CurvatureDeflection > gp::Resolution() must be 0043 //! satisfied at the construction time. 0044 //! 0045 //! A minimum number of points can be fixed for a linear or circular element. 0046 //! Example: 0047 //! @code 0048 //! occ::handle<Geom_BezierCurve> aCurve = new Geom_BezierCurve (thePoles); 0049 //! GeomAdaptor_Curve aCurveAdaptor (aCurve); 0050 //! double aCDeflect = 0.01; // Curvature deflection 0051 //! double anADeflect = 0.09; // Angular deflection 0052 //! 0053 //! GCPnts_TangentialDeflection aPointsOnCurve; 0054 //! aPointsOnCurve.Initialize (aCurveAdaptor, anADeflect, aCDeflect); 0055 //! for (int i = 1; i <= aPointsOnCurve.NbPoints(); ++i) 0056 //! { 0057 //! double aU = aPointsOnCurve.Parameter (i); 0058 //! gp_Pnt aPnt = aPointsOnCurve.Value (i); 0059 //! } 0060 //! @endcode 0061 class GCPnts_TangentialDeflection 0062 { 0063 public: 0064 DEFINE_STANDARD_ALLOC 0065 0066 //! Empty constructor. 0067 //! @sa Initialize() 0068 Standard_EXPORT GCPnts_TangentialDeflection(); 0069 0070 //! Constructor for 3D curve. 0071 //! @param[in] theC 3d curve 0072 //! @param[in] theAngularDeflection angular deflection in radians 0073 //! @param[in] theCurvatureDeflection linear deflection 0074 //! @param[in] theMinimumOfPoints minimum number of points 0075 //! @param[in] theUTol tolerance in curve parametric scope 0076 //! @param[in] theMinLen minimal length 0077 Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& theC, 0078 const double theAngularDeflection, 0079 const double theCurvatureDeflection, 0080 const int theMinimumOfPoints = 2, 0081 const double theUTol = 1.0e-9, 0082 const double theMinLen = 1.0e-7); 0083 0084 //! Constructor for 3D curve with restricted range. 0085 //! @param[in] theC 3d curve 0086 //! @param[in] theFirstParameter first parameter on curve 0087 //! @param[in] theLastParameter last parameter on curve 0088 //! @param[in] theAngularDeflection angular deflection in radians 0089 //! @param[in] theCurvatureDeflection linear deflection 0090 //! @param[in] theMinimumOfPoints minimum number of points 0091 //! @param theUTo l[in] tolerance in curve parametric scope 0092 //! @param[in] theMinLen minimal length 0093 Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor3d_Curve& theC, 0094 const double theFirstParameter, 0095 const double theLastParameter, 0096 const double theAngularDeflection, 0097 const double theCurvatureDeflection, 0098 const int theMinimumOfPoints = 2, 0099 const double theUTol = 1.0e-9, 0100 const double theMinLen = 1.0e-7); 0101 0102 //! Constructor for 2D curve. 0103 //! @param[in] theC 2d curve 0104 //! @param[in] theAngularDeflection angular deflection in radians 0105 //! @param[in] theCurvatureDeflection linear deflection 0106 //! @param[in] theMinimumOfPoints minimum number of points 0107 //! @param[in] theUTol tolerance in curve parametric scope 0108 //! @param[in] theMinLen minimal length 0109 Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& theC, 0110 const double theAngularDeflection, 0111 const double theCurvatureDeflection, 0112 const int theMinimumOfPoints = 2, 0113 const double theUTol = 1.0e-9, 0114 const double theMinLen = 1.0e-7); 0115 0116 //! Constructor for 2D curve with restricted range. 0117 //! @param[in] theC 2d curve 0118 //! @param[in] theFirstParameter first parameter on curve 0119 //! @param[in] theLastParameter last parameter on curve 0120 //! @param[in] theAngularDeflection angular deflection in radians 0121 //! @param[in] theCurvatureDeflection linear deflection 0122 //! @param[in] theMinimumOfPoints minimum number of points 0123 //! @param[in] theUTol tolerance in curve parametric scope 0124 //! @param[in] theMinLen minimal length 0125 Standard_EXPORT GCPnts_TangentialDeflection(const Adaptor2d_Curve2d& theC, 0126 const double theFirstParameter, 0127 const double theLastParameter, 0128 const double theAngularDeflection, 0129 const double theCurvatureDeflection, 0130 const int theMinimumOfPoints = 2, 0131 const double theUTol = 1.0e-9, 0132 const double theMinLen = 1.0e-7); 0133 0134 //! Initialize algorithm for 3D curve. 0135 //! @param[in] theC 3d curve 0136 //! @param[in] theAngularDeflection angular deflection in radians 0137 //! @param[in] theCurvatureDeflection linear deflection 0138 //! @param[in] theMinimumOfPoints minimum number of points 0139 //! @param[in] theUTol tolerance in curve parametric scope 0140 //! @param[in] theMinLen minimal length 0141 Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, 0142 const double theAngularDeflection, 0143 const double theCurvatureDeflection, 0144 const int theMinimumOfPoints = 2, 0145 const double theUTol = 1.0e-9, 0146 const double theMinLen = 1.0e-7); 0147 0148 //! Initialize algorithm for 3D curve with restricted range. 0149 //! @param[in] theC 3d curve 0150 //! @param[in] theFirstParameter first parameter on curve 0151 //! @param[in] theLastParameter last parameter on curve 0152 //! @param[in] theAngularDeflection angular deflection in radians 0153 //! @param[in] theCurvatureDeflection linear deflection 0154 //! @param[in] theMinimumOfPoints minimum number of points 0155 //! @param[in] theUTol tolerance in curve parametric scope 0156 //! @param[in] theMinLen minimal length 0157 Standard_EXPORT void Initialize(const Adaptor3d_Curve& theC, 0158 const double theFirstParameter, 0159 const double theLastParameter, 0160 const double theAngularDeflection, 0161 const double theCurvatureDeflection, 0162 const int theMinimumOfPoints = 2, 0163 const double theUTol = 1.0e-9, 0164 const double theMinLen = 1.0e-7); 0165 0166 //! Initialize algorithm for 2D curve. 0167 //! @param[in] theC 2d curve 0168 //! @param[in] theAngularDeflection angular deflection in radians 0169 //! @param[in] theCurvatureDeflection linear deflection 0170 //! @param[in] theMinimumOfPoints minimum number of points 0171 //! @param[in] theUTol tolerance in curve parametric scope 0172 //! @param[in] theMinLen minimal length 0173 Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, 0174 const double theAngularDeflection, 0175 const double theCurvatureDeflection, 0176 const int theMinimumOfPoints = 2, 0177 const double theUTol = 1.0e-9, 0178 const double theMinLen = 1.0e-7); 0179 0180 //! Initialize algorithm for 2D curve with restricted range. 0181 //! @param[in] theC 2d curve 0182 //! @param[in] theFirstParameter first parameter on curve 0183 //! @param[in] theLastParameter last parameter on curve 0184 //! @param[in] theAngularDeflection angular deflection in radians 0185 //! @param[in] theCurvatureDeflection linear deflection 0186 //! @param[in] theMinimumOfPoints minimum number of points 0187 //! @param[in] theUTol tolerance in curve parametric scope 0188 //! @param[in] theMinLen minimal length 0189 Standard_EXPORT void Initialize(const Adaptor2d_Curve2d& theC, 0190 const double theFirstParameter, 0191 const double theLastParameter, 0192 const double theAngularDeflection, 0193 const double theCurvatureDeflection, 0194 const int theMinimumOfPoints = 2, 0195 const double theUTol = 1.0e-9, 0196 const double theMinLen = 1.0e-7); 0197 0198 //! Add point to already calculated points (or replace existing) 0199 //! Returns index of new added point 0200 //! or founded with parametric tolerance (replaced if theIsReplace is true) 0201 Standard_EXPORT int AddPoint(const gp_Pnt& thePnt, 0202 const double theParam, 0203 const bool theIsReplace = true); 0204 0205 int NbPoints() const { return myParameters.Length(); } 0206 0207 double Parameter(const int I) const { return myParameters.Value(I); } 0208 0209 gp_Pnt Value(const int I) const { return myPoints.Value(I); } 0210 0211 //! Computes angular step for the arc using the given parameters. 0212 Standard_EXPORT static double ArcAngularStep(const double theRadius, 0213 const double theLinearDeflection, 0214 const double theAngularDeflection, 0215 const double theMinLength); 0216 0217 private: 0218 template <class TheCurve> 0219 void initialize(const TheCurve& theC, 0220 const double theFirstParameter, 0221 const double theLastParameter, 0222 const double theAngularDeflection, 0223 const double theCurvatureDeflection, 0224 const int theMinimumOfPoints, 0225 const double theUTol, 0226 const double theMinLen); 0227 0228 template <class TheCurve> 0229 void PerformLinear(const TheCurve& theC); 0230 0231 template <class TheCurve> 0232 void PerformCircular(const TheCurve& theC); 0233 0234 //! Respecting the angle and the deflection, 0235 //! we impose a minimum number of points on a curve. 0236 template <class TheCurve> 0237 void PerformCurve(const TheCurve& theC); 0238 0239 template <class TheCurve> 0240 void EvaluateDu(const TheCurve& theC, 0241 const double theU, 0242 gp_Pnt& theP, 0243 double& theDu, 0244 bool& theNotDone) const; 0245 0246 //! Estimation of maximal deflection for interval [theU1, theU2] 0247 template <class TheCurve> 0248 void EstimDefl(const TheCurve& theC, 0249 const double theU1, 0250 const double theU2, 0251 double& theMaxDefl, 0252 double& theUMax); 0253 0254 private: 0255 double myAngularDeflection; 0256 double myCurvatureDeflection; 0257 double myUTol; 0258 int myMinNbPnts; 0259 double myMinLen; 0260 double myLastU; 0261 double myFirstu; 0262 NCollection_Sequence<gp_Pnt> myPoints; 0263 NCollection_Sequence<double> myParameters; 0264 }; 0265 0266 #endif // _GCPnts_TangentialDeflection_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|