0032768: Coding - get rid of unused headers [BopAlgo to BRepBuilderAPI]
[occt.git] / src / BRepApprox / BRepApprox_TheComputeLineBezierOfApprox.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-06-06
2// Created by: Jean Yves LEBEY
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile
18#define _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <AppParCurves_SequenceOfMultiCurve.hxx>
25#include <AppParCurves_MultiCurve.hxx>
26#include <AppParCurves_MultiBSpCurve.hxx>
42cf5bc1 27#include <Approx_ParametrizationType.hxx>
28#include <TColStd_HArray1OfReal.hxx>
29#include <Approx_SequenceOfHArray1OfReal.hxx>
30#include <TColStd_SequenceOfReal.hxx>
31#include <AppParCurves_HArray1OfConstraintCouple.hxx>
32#include <Standard_Integer.hxx>
42cf5bc1 33#include <AppParCurves_Constraint.hxx>
34#include <math_Vector.hxx>
35#include <TColStd_Array1OfReal.hxx>
36class BRepApprox_TheMultiLineOfApprox;
37class BRepApprox_TheMultiLineToolOfApprox;
38class BRepApprox_MyGradientOfTheComputeLineBezierOfApprox;
39class BRepApprox_ParLeastSquareOfMyGradientOfTheComputeLineBezierOfApprox;
40class BRepApprox_ResConstraintOfMyGradientOfTheComputeLineBezierOfApprox;
41class BRepApprox_ParFunctionOfMyGradientOfTheComputeLineBezierOfApprox;
42class BRepApprox_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfApprox;
43class AppParCurves_MultiCurve;
44class AppParCurves_MultiBSpCurve;
45
46
47
48class BRepApprox_TheComputeLineBezierOfApprox
49{
50public:
51
52 DEFINE_STANDARD_ALLOC
53
54
36b9ff75 55 //! The MultiLine <Line> will be approximated until tolerances
56 //! will be reached.
57 //! The approximation will be done from degreemin to degreemax
58 //! with a cutting if the corresponding boolean is True.
59 //! If <Squares> is True, the computation will be done with
60 //! no iteration at all.
42cf5bc1 61 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const BRepApprox_TheMultiLineOfApprox& Line, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-3, const Standard_Real Tolerance2d = 1.0e-6, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
62
36b9ff75 63 //! The MultiLine <Line> will be approximated until tolerances
64 //! will be reached.
65 //! The approximation will be done from degreemin to degreemax
66 //! with a cutting if the corresponding boolean is True.
67 //! If <Squares> is True, the computation will be done with
68 //! no iteration at all.
42cf5bc1 69 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const BRepApprox_TheMultiLineOfApprox& Line, const math_Vector& Parameters, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Standard_Boolean Squares = Standard_False);
70
36b9ff75 71 //! Initializes the fields of the algorithm.
42cf5bc1 72 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const math_Vector& Parameters, const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Standard_Boolean Squares = Standard_False);
73
36b9ff75 74 //! Initializes the fields of the algorithm.
42cf5bc1 75 Standard_EXPORT BRepApprox_TheComputeLineBezierOfApprox(const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
76
36b9ff75 77 //! Initializes the fields of the algorithm.
42cf5bc1 78 Standard_EXPORT void Init (const Standard_Integer degreemin = 4, const Standard_Integer degreemax = 8, const Standard_Real Tolerance3d = 1.0e-03, const Standard_Real Tolerance2d = 1.0e-06, const Standard_Integer NbIterations = 5, const Standard_Boolean cutting = Standard_True, const Approx_ParametrizationType parametrization = Approx_ChordLength, const Standard_Boolean Squares = Standard_False);
79
36b9ff75 80 //! runs the algorithm after having initialized the fields.
42cf5bc1 81 Standard_EXPORT void Perform (const BRepApprox_TheMultiLineOfApprox& Line);
82
36b9ff75 83 //! changes the degrees of the approximation.
42cf5bc1 84 Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
85
36b9ff75 86 //! Changes the tolerances of the approximation.
42cf5bc1 87 Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
88
36b9ff75 89 //! changes the first and the last constraint points.
42cf5bc1 90 Standard_EXPORT void SetConstraints (const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC);
91
36b9ff75 92 //! returns False if at a moment of the approximation,
93 //! the status NoApproximation has been sent by the user
94 //! when more points were needed.
42cf5bc1 95 Standard_EXPORT Standard_Boolean IsAllApproximated() const;
96
36b9ff75 97 //! returns False if the status NoPointsAdded has been sent.
42cf5bc1 98 Standard_EXPORT Standard_Boolean IsToleranceReached() const;
99
36b9ff75 100 //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
42cf5bc1 101 Standard_EXPORT void Error (const Standard_Integer Index, Standard_Real& tol3d, Standard_Real& tol2d) const;
102
36b9ff75 103 //! Returns the number of MultiCurve doing the approximation
104 //! of the MultiLine.
42cf5bc1 105 Standard_EXPORT Standard_Integer NbMultiCurves() const;
106
36b9ff75 107 //! returns the result of the approximation.
42cf5bc1 108 Standard_EXPORT const AppParCurves_MultiCurve& Value (const Standard_Integer Index = 1) const;
109
36b9ff75 110 //! returns the result of the approximation.
42cf5bc1 111 Standard_EXPORT AppParCurves_MultiCurve& ChangeValue (const Standard_Integer Index = 1);
112
36b9ff75 113 //! returns the result of the approximation.
42cf5bc1 114 Standard_EXPORT const AppParCurves_MultiBSpCurve& SplineValue();
115
36b9ff75 116 //! returns the type of parametrization
4e14c88f 117 Standard_EXPORT Approx_ParametrizationType Parametrization () const;
42cf5bc1 118
36b9ff75 119 //! returns the new parameters of the approximation
120 //! corresponding to the points of the multicurve <Index>.
42cf5bc1 121 Standard_EXPORT const TColStd_Array1OfReal& Parameters (const Standard_Integer Index = 1) const;
122
42cf5bc1 123protected:
124
125
126
127
128
129private:
130
131
36b9ff75 132 //! is internally used in the algorithm.
2c26a53d 133 Standard_EXPORT Standard_Boolean Compute (const BRepApprox_TheMultiLineOfApprox& Line,
134 const Standard_Integer fpt,
135 const Standard_Integer lpt,
136 math_Vector& Para,
137 Standard_Real& TheTol3d,
138 Standard_Real& TheTol2d,
139 Standard_Integer& indbad);
42cf5bc1 140
36b9ff75 141 //! is internally used in the algorithm.
42cf5bc1 142 Standard_EXPORT Standard_Boolean ComputeCurve (const BRepApprox_TheMultiLineOfApprox& Line, const Standard_Integer firspt, const Standard_Integer lastpt);
143
36b9ff75 144 //! computes new parameters between firstP and lastP.
42cf5bc1 145 Standard_EXPORT void Parameters (const BRepApprox_TheMultiLineOfApprox& Line, const Standard_Integer firstP, const Standard_Integer LastP, math_Vector& TheParameters) const;
146
147 Standard_EXPORT Standard_Real SearchFirstLambda (const BRepApprox_TheMultiLineOfApprox& Line, const math_Vector& Para, const math_Vector& V, const Standard_Integer index) const;
148
149 Standard_EXPORT Standard_Real SearchLastLambda (const BRepApprox_TheMultiLineOfApprox& Line, const math_Vector& Para, const math_Vector& V, const Standard_Integer index) const;
150
151 Standard_EXPORT void FirstTangencyVector (const BRepApprox_TheMultiLineOfApprox& Line, const Standard_Integer index, math_Vector& V) const;
152
153 Standard_EXPORT void LastTangencyVector (const BRepApprox_TheMultiLineOfApprox& Line, const Standard_Integer index, math_Vector& V) const;
154
155
156 AppParCurves_SequenceOfMultiCurve myMultiCurves;
157 AppParCurves_MultiCurve TheMultiCurve;
158 AppParCurves_MultiBSpCurve myspline;
159 Standard_Boolean alldone;
160 Standard_Boolean tolreached;
161 Approx_ParametrizationType Par;
162 Handle(TColStd_HArray1OfReal) myParameters;
163 Handle(TColStd_HArray1OfReal) myfirstParam;
164 Approx_SequenceOfHArray1OfReal myPar;
165 TColStd_SequenceOfReal Tolers3d;
166 TColStd_SequenceOfReal Tolers2d;
167 Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
168 Standard_Integer mydegremin;
169 Standard_Integer mydegremax;
170 Standard_Real mytol3d;
171 Standard_Real mytol2d;
172 Standard_Real currenttol3d;
173 Standard_Real currenttol2d;
174 Standard_Boolean mycut;
175 Standard_Boolean mysquares;
176 Standard_Integer myitermax;
177 AppParCurves_Constraint myfirstC;
178 AppParCurves_Constraint mylastC;
179 Standard_Integer myMultiLineNb;
180 Standard_Boolean myIsClear;
181
182
183};
184
185
186
187
188
189
190
191#endif // _BRepApprox_TheComputeLineBezierOfApprox_HeaderFile