File indexing completed on 2026-09-25 09:19:08
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile
0018 #define _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023
0024 #include <AppParCurves_MultiCurve.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 #include <AppParCurves_MultiBSpCurve.hxx>
0027 #include <Approx_ParametrizationType.hxx>
0028 #include <NCollection_Array1.hxx>
0029 #include <NCollection_HArray1.hxx>
0030 #include <AppParCurves_ConstraintCouple.hxx>
0031 #include <Standard_Integer.hxx>
0032 #include <AppParCurves_Constraint.hxx>
0033 #include <math_Vector.hxx>
0034 class BRepApprox_TheMultiLineOfApprox;
0035 class BRepApprox_TheMultiLineToolOfApprox;
0036 class BRepApprox_MyGradientOfTheComputeLineBezierOfApprox;
0037 class BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox;
0038 class BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox;
0039 class BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox;
0040 class BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox;
0041 class AppParCurves_MultiCurve;
0042 class AppParCurves_MultiBSpCurve;
0043
0044 class BRepApprox_TheComputeLineBezierOfApprox
0045 {
0046 public:
0047 DEFINE_STANDARD_ALLOC
0048
0049
0050
0051
0052
0053
0054
0055 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(
0056 const BRepApprox_TheMultiLineOfApprox& Line,
0057 const int degreemin = 4,
0058 const int degreemax = 8,
0059 const double Tolerance3d = 1.0e-3,
0060 const double Tolerance2d = 1.0e-6,
0061 const int NbIterations = 5,
0062 const bool cutting = true,
0063 const Approx_ParametrizationType parametrization = Approx_ChordLength,
0064 const bool Squares = false);
0065
0066
0067
0068
0069
0070
0071
0072 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(
0073 const BRepApprox_TheMultiLineOfApprox& Line,
0074 const math_Vector& Parameters,
0075 const int degreemin = 4,
0076 const int degreemax = 8,
0077 const double Tolerance3d = 1.0e-03,
0078 const double Tolerance2d = 1.0e-06,
0079 const int NbIterations = 5,
0080 const bool cutting = true,
0081 const bool Squares = false);
0082
0083
0084 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const math_Vector& Parameters,
0085 const int degreemin = 4,
0086 const int degreemax = 8,
0087 const double Tolerance3d = 1.0e-03,
0088 const double Tolerance2d = 1.0e-06,
0089 const int NbIterations = 5,
0090 const bool cutting = true,
0091 const bool Squares = false);
0092
0093
0094 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(
0095 const int degreemin = 4,
0096 const int degreemax = 8,
0097 const double Tolerance3d = 1.0e-03,
0098 const double Tolerance2d = 1.0e-06,
0099 const int NbIterations = 5,
0100 const bool cutting = true,
0101 const Approx_ParametrizationType parametrization = Approx_ChordLength,
0102 const bool Squares = false);
0103
0104
0105 Standard_EXPORT void Init(const int degreemin = 4,
0106 const int degreemax = 8,
0107 const double Tolerance3d = 1.0e-03,
0108 const double Tolerance2d = 1.0e-06,
0109 const int NbIterations = 5,
0110 const bool cutting = true,
0111 const Approx_ParametrizationType parametrization = Approx_ChordLength,
0112 const bool Squares = false);
0113
0114
0115 Standard_EXPORT void Perform(const BRepApprox_TheMultiLineOfApprox& Line);
0116
0117
0118 Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax);
0119
0120
0121 Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d);
0122
0123
0124 Standard_EXPORT void SetConstraints(const AppParCurves_Constraint firstC,
0125 const AppParCurves_Constraint lastC);
0126
0127
0128
0129
0130 Standard_EXPORT bool IsAllApproximated() const;
0131
0132
0133 Standard_EXPORT bool IsToleranceReached() const;
0134
0135
0136 Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const;
0137
0138
0139
0140 Standard_EXPORT int NbMultiCurves() const;
0141
0142
0143 Standard_EXPORT const AppParCurves_MultiCurve& Value(const int Index = 1) const;
0144
0145
0146 Standard_EXPORT AppParCurves_MultiCurve& ChangeValue(const int Index = 1);
0147
0148
0149 Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue();
0150
0151
0152 Standard_EXPORT Approx_ParametrizationType Parametrization() const;
0153
0154
0155
0156 Standard_EXPORT const NCollection_Array1<double>& Parameters(const int Index = 1) const;
0157
0158 private:
0159
0160 Standard_EXPORT bool Compute(const BRepApprox_TheMultiLineOfApprox& Line,
0161 const int fpt,
0162 const int lpt,
0163 math_Vector& Para,
0164 double& TheTol3d,
0165 double& TheTol2d,
0166 int& indbad);
0167
0168
0169 Standard_EXPORT bool ComputeCurve(const BRepApprox_TheMultiLineOfApprox& Line,
0170 const int firspt,
0171 const int lastpt);
0172
0173
0174 Standard_EXPORT void Parameters(const BRepApprox_TheMultiLineOfApprox& Line,
0175 const int firstP,
0176 const int LastP,
0177 math_Vector& TheParameters) const;
0178
0179 Standard_EXPORT double SearchFirstLambda(const BRepApprox_TheMultiLineOfApprox& Line,
0180 const math_Vector& Para,
0181 const math_Vector& V,
0182 const int index) const;
0183
0184 Standard_EXPORT double SearchLastLambda(const BRepApprox_TheMultiLineOfApprox& Line,
0185 const math_Vector& Para,
0186 const math_Vector& V,
0187 const int index) const;
0188
0189 Standard_EXPORT void FirstTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line,
0190 const int index,
0191 math_Vector& V) const;
0192
0193 Standard_EXPORT void LastTangencyVector(const BRepApprox_TheMultiLineOfApprox& Line,
0194 const int index,
0195 math_Vector& V) const;
0196
0197 NCollection_Sequence<AppParCurves_MultiCurve> myMultiCurves;
0198 AppParCurves_MultiCurve TheMultiCurve;
0199 AppParCurves_MultiBSpCurve myspline;
0200 bool alldone;
0201 bool tolreached;
0202 Approx_ParametrizationType Par;
0203 occ::handle<NCollection_HArray1<double>> myParameters;
0204 occ::handle<NCollection_HArray1<double>> myfirstParam;
0205 NCollection_Sequence<occ::handle<NCollection_HArray1<double>>> myPar;
0206 NCollection_Sequence<double> Tolers3d;
0207 NCollection_Sequence<double> Tolers2d;
0208 occ::handle<NCollection_HArray1<AppParCurves_ConstraintCouple>> myConstraints;
0209 int mydegremin;
0210 int mydegremax;
0211 double mytol3d;
0212 double mytol2d;
0213 double currenttol3d;
0214 double currenttol2d;
0215 bool mycut;
0216 bool mysquares;
0217 int myitermax;
0218 AppParCurves_Constraint myfirstC;
0219 AppParCurves_Constraint mylastC;
0220 int myMultiLineNb;
0221 bool myIsClear;
0222 };
0223
0224 #endif