File indexing completed on 2026-09-25 09:18:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _Approx_SameParameter_HeaderFile
0018 #define _Approx_SameParameter_HeaderFile
0019
0020 #include <Adaptor3d_CurveOnSurface.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022
0023 class Geom_Curve;
0024 class Geom2d_Curve;
0025 class Geom_Surface;
0026
0027
0028
0029
0030 class Approx_SameParameter
0031 {
0032 public:
0033 DEFINE_STANDARD_ALLOC
0034
0035
0036 Standard_EXPORT Approx_SameParameter(const occ::handle<Geom_Curve>& C3D,
0037 const occ::handle<Geom2d_Curve>& C2D,
0038 const occ::handle<Geom_Surface>& S,
0039 const double Tol);
0040
0041
0042 Standard_EXPORT Approx_SameParameter(const occ::handle<Adaptor3d_Curve>& C3D,
0043 const occ::handle<Geom2d_Curve>& C2D,
0044 const occ::handle<Adaptor3d_Surface>& S,
0045 const double Tol);
0046
0047
0048 Standard_EXPORT Approx_SameParameter(const occ::handle<Adaptor3d_Curve>& C3D,
0049 const occ::handle<Adaptor2d_Curve2d>& C2D,
0050 const occ::handle<Adaptor3d_Surface>& S,
0051 const double Tol);
0052
0053
0054
0055 bool IsDone() const { return myDone; }
0056
0057
0058
0059 double TolReached() const { return myTolReached; }
0060
0061
0062
0063
0064 bool IsSameParameter() const { return mySameParameter; }
0065
0066
0067
0068
0069 occ::handle<Geom2d_Curve> Curve2d() const { return myCurve2d; }
0070
0071
0072
0073
0074 occ::handle<Adaptor3d_Curve> Curve3d() const { return myC3d; }
0075
0076
0077
0078 occ::handle<Adaptor3d_CurveOnSurface> CurveOnSurface() const { return myCurveOnSurface; }
0079
0080 private:
0081
0082
0083
0084 struct Approx_SameParameter_Data
0085 {
0086 Adaptor3d_CurveOnSurface myCOnS;
0087 int myNbPnt;
0088 double* myPC3d;
0089 double* myPC2d;
0090
0091
0092 double* myNewPC3d;
0093 double* myNewPC2d;
0094
0095
0096 double myC3dPF;
0097 double myC3dPL;
0098 double myC2dPF;
0099 double myC2dPL;
0100
0101 double myTol;
0102
0103
0104 void Swap(const int theNewNbPoints)
0105 {
0106 myNbPnt = theNewNbPoints;
0107 double* temp;
0108
0109
0110 temp = myPC3d;
0111 myPC3d = myNewPC3d;
0112 myNewPC3d = temp;
0113
0114
0115 temp = myPC2d;
0116 myPC2d = myNewPC2d;
0117 myNewPC2d = temp;
0118 }
0119 };
0120
0121 Approx_SameParameter(const Approx_SameParameter&) = delete;
0122 Approx_SameParameter& operator=(const Approx_SameParameter&) = delete;
0123
0124
0125 Standard_EXPORT void Build(const double Tol);
0126
0127
0128 bool BuildInitialDistribution(Approx_SameParameter_Data& theData) const;
0129
0130
0131
0132
0133 bool IncreaseInitialNbSamples(Approx_SameParameter_Data& theData) const;
0134
0135
0136
0137 bool ComputeTangents(const Adaptor3d_CurveOnSurface& theCOnS,
0138 double& theFirstTangent,
0139 double& theLastTangent) const;
0140
0141
0142
0143
0144 bool CheckSameParameter(Approx_SameParameter_Data& theData, double& theSqDist) const;
0145
0146
0147
0148 bool Interpolate(const Approx_SameParameter_Data& theData,
0149 const double aTangFirst,
0150 const double aTangLast,
0151 NCollection_Array1<double>& thePoles,
0152 NCollection_Array1<double>& theFlatKnots) const;
0153
0154
0155
0156 bool IncreaseNbPoles(const NCollection_Array1<double>& thePoles,
0157 const NCollection_Array1<double>& theFlatKnots,
0158 Approx_SameParameter_Data& theData,
0159 double& theBestSqTol) const;
0160
0161 static const int myNbSamples = 22;
0162 static const int myMaxArraySize = 1000;
0163 const double myDeltaMin;
0164
0165 bool mySameParameter;
0166 bool myDone;
0167 double myTolReached;
0168 occ::handle<Geom2d_Curve> myCurve2d;
0169 occ::handle<Adaptor2d_Curve2d> myHCurve2d;
0170 occ::handle<Adaptor3d_Curve> myC3d;
0171 occ::handle<Adaptor3d_Surface> mySurf;
0172 occ::handle<Adaptor3d_CurveOnSurface> myCurveOnSurface;
0173 };
0174
0175 #endif