0032951: Coding - get rid of unused headers [GeomConvert to IGESBasic]
[occt.git] / src / GeomInt / GeomInt_TheComputeLineOfWLApprox.hxx
1 // Created on: 1995-01-27
2 // Created by: Jacques GOUSSARD
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 _GeomInt_TheComputeLineOfWLApprox_HeaderFile
18 #define _GeomInt_TheComputeLineOfWLApprox_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <AppParCurves_MultiBSpCurve.hxx>
25 #include <Approx_ParametrizationType.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
27 #include <TColStd_HArray1OfInteger.hxx>
28 #include <AppParCurves_HArray1OfConstraintCouple.hxx>
29 #include <Standard_Integer.hxx>
30 #include <AppParCurves_Constraint.hxx>
31 #include <math_Vector.hxx>
32 #include <TColStd_Array1OfReal.hxx>
33 #include <TColStd_Array1OfInteger.hxx>
34 class GeomInt_TheMultiLineOfWLApprox;
35 class GeomInt_TheMultiLineToolOfWLApprox;
36 class GeomInt_MyBSplGradientOfTheComputeLineOfWLApprox;
37 class GeomInt_BSpParLeastSquareOfMyBSplGradientOfTheComputeLineOfWLApprox;
38 class GeomInt_BSpParFunctionOfMyBSplGradientOfTheComputeLineOfWLApprox;
39 class GeomInt_BSpGradient_BFGSOfMyBSplGradientOfTheComputeLineOfWLApprox;
40 class GeomInt_MyGradientbisOfTheComputeLineOfWLApprox;
41 class GeomInt_ParLeastSquareOfMyGradientbisOfTheComputeLineOfWLApprox;
42 class GeomInt_ResConstraintOfMyGradientbisOfTheComputeLineOfWLApprox;
43 class GeomInt_ParFunctionOfMyGradientbisOfTheComputeLineOfWLApprox;
44 class GeomInt_Gradient_BFGSOfMyGradientbisOfTheComputeLineOfWLApprox;
45 class AppParCurves_MultiBSpCurve;
46 class AppParCurves_MultiCurve;
47
48
49
50 class GeomInt_TheComputeLineOfWLApprox 
51 {
52 public:
53
54   DEFINE_STANDARD_ALLOC
55
56   
57   //! The MultiLine <Line> will be approximated until tolerances
58   //! will be reached.
59   //! The approximation will be done from degreemin to degreemax
60   //! with a cutting if the corresponding boolean is True.
61   //! If <Squares> is True, the computation will be done with
62   //! no iteration at all.
63   //!
64   //! The multiplicities of the internal knots is set by
65   //! default.
66   Standard_EXPORT GeomInt_TheComputeLineOfWLApprox(const GeomInt_TheMultiLineOfWLApprox& 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);
67   
68   //! The MultiLine <Line> will be approximated until tolerances
69   //! will be reached.
70   //! The approximation will be done from degreemin to degreemax
71   //! with a cutting if the corresponding boolean is True.
72   //! If <Squares> is True, the computation will be done with
73   //! no iteration at all.
74   Standard_EXPORT GeomInt_TheComputeLineOfWLApprox(const GeomInt_TheMultiLineOfWLApprox& 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);
75   
76   //! Initializes the fields of the algorithm.
77   Standard_EXPORT GeomInt_TheComputeLineOfWLApprox(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);
78   
79   //! Initializes the fields of the algorithm.
80   Standard_EXPORT GeomInt_TheComputeLineOfWLApprox(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);
81   
82   //! Constructs an interpolation of the MultiLine <Line>
83   //! The result will be a C2 curve of degree 3.
84   Standard_EXPORT void Interpol (const GeomInt_TheMultiLineOfWLApprox& Line);
85   
86   //! Initializes the fields of the algorithm.
87   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);
88   
89   //! runs the algorithm after having initialized the fields.
90   Standard_EXPORT void Perform (const GeomInt_TheMultiLineOfWLApprox& Line);
91   
92   //! The approximation will begin with the
93   //! set of  parameters <ThePar>.
94   Standard_EXPORT void SetParameters (const math_Vector& ThePar);
95   
96   //! The approximation will be done with the
97   //! set of knots <Knots>. The multiplicities will be set
98   //! with the degree and the desired continuity.
99   Standard_EXPORT void SetKnots (const TColStd_Array1OfReal& Knots);
100   
101   //! The approximation will be done with the
102   //! set of knots <Knots> and the multiplicities <Mults>.
103   Standard_EXPORT void SetKnotsAndMultiplicities (const TColStd_Array1OfReal& Knots, const TColStd_Array1OfInteger& Mults);
104   
105   //! changes the degrees of the approximation.
106   Standard_EXPORT void SetDegrees (const Standard_Integer degreemin, const Standard_Integer degreemax);
107   
108   //! Changes the tolerances of the approximation.
109   Standard_EXPORT void SetTolerances (const Standard_Real Tolerance3d, const Standard_Real Tolerance2d);
110   
111   //! sets the continuity of the spline.
112   //! if C = 2, the spline will be C2.
113   Standard_EXPORT void SetContinuity (const Standard_Integer C);
114   
115   //! changes the first and the last constraint points.
116   Standard_EXPORT void SetConstraints (const AppParCurves_Constraint firstC, const AppParCurves_Constraint lastC);
117
118   //! Sets periodic flag.
119   //! If thePeriodic = Standard_True, algorithm tries to build periodic
120   //! multicurve using corresponding C1 boundary condition for first and last multipoints.
121   //! Multiline must be closed.
122   Standard_EXPORT void SetPeriodic(const Standard_Boolean thePeriodic);
123
124   //! returns False if at a moment of the approximation,
125   //! the status NoApproximation has been sent by the user
126   //! when more points were needed.
127   Standard_EXPORT Standard_Boolean IsAllApproximated() const;
128   
129   //! returns False if the status NoPointsAdded has been sent.
130   Standard_EXPORT Standard_Boolean IsToleranceReached() const;
131   
132   //! returns the tolerances 2d and 3d of the MultiBSpCurve.
133   Standard_EXPORT void Error (Standard_Real& tol3d, Standard_Real& tol2d) const;
134   
135   //! returns the result of the approximation.
136   Standard_EXPORT const AppParCurves_MultiBSpCurve& Value() const;
137   
138   //! returns the result of the approximation.
139   Standard_EXPORT AppParCurves_MultiBSpCurve& ChangeValue();
140   
141   //! returns the new parameters of the approximation
142   //! corresponding to the points of the MultiBSpCurve.
143   Standard_EXPORT const TColStd_Array1OfReal& Parameters() const;
144
145
146
147
148 protected:
149
150
151
152
153
154 private:
155
156   
157   //! is internally used in the algorithm.
158   Standard_EXPORT Standard_Boolean Compute (const GeomInt_TheMultiLineOfWLApprox& Line, const Standard_Integer fpt, const Standard_Integer lpt, math_Vector& Para, const TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults);
159   
160   //! is internally used in the algorithm.
161   Standard_EXPORT Standard_Boolean ComputeCurve (const GeomInt_TheMultiLineOfWLApprox& Line, const Standard_Integer firspt, const Standard_Integer lastpt);
162   
163   //! computes new parameters between firstP and lastP.
164   Standard_EXPORT void Parameters (const GeomInt_TheMultiLineOfWLApprox& Line, const Standard_Integer firstP, const Standard_Integer LastP, math_Vector& TheParameters) const;
165   
166   Standard_EXPORT Standard_Real SearchFirstLambda (const GeomInt_TheMultiLineOfWLApprox& Line, const math_Vector& Para, const TColStd_Array1OfReal& Knots, const math_Vector& V, const Standard_Integer index) const;
167   
168   Standard_EXPORT Standard_Real SearchLastLambda (const GeomInt_TheMultiLineOfWLApprox& Line, const math_Vector& Para, const TColStd_Array1OfReal& Knots, const math_Vector& V, const Standard_Integer index) const;
169   
170   Standard_EXPORT void TangencyVector (const GeomInt_TheMultiLineOfWLApprox& Line, const AppParCurves_MultiCurve& C, const Standard_Real U, math_Vector& V) const;
171   
172   Standard_EXPORT void FirstTangencyVector (const GeomInt_TheMultiLineOfWLApprox& Line, const Standard_Integer index, math_Vector& V) const;
173   
174   Standard_EXPORT void LastTangencyVector (const GeomInt_TheMultiLineOfWLApprox& Line, const Standard_Integer index, math_Vector& V) const;
175   
176   Standard_EXPORT void FindRealConstraints (const GeomInt_TheMultiLineOfWLApprox& Line);
177
178
179   AppParCurves_MultiBSpCurve TheMultiBSpCurve;
180   Standard_Boolean alldone;
181   Standard_Boolean tolreached;
182   Approx_ParametrizationType Par;
183   Handle(TColStd_HArray1OfReal) myParameters;
184   Handle(TColStd_HArray1OfReal) myfirstParam;
185   Handle(TColStd_HArray1OfReal) myknots;
186   Handle(TColStd_HArray1OfInteger) mymults;
187   Standard_Boolean myhasknots;
188   Standard_Boolean myhasmults;
189   Handle(AppParCurves_HArray1OfConstraintCouple) myConstraints;
190   Standard_Integer mydegremin;
191   Standard_Integer mydegremax;
192   Standard_Real mytol3d;
193   Standard_Real mytol2d;
194   Standard_Real currenttol3d;
195   Standard_Real currenttol2d;
196   Standard_Boolean mycut;
197   Standard_Boolean mysquares;
198   Standard_Integer myitermax;
199   AppParCurves_Constraint myfirstC;
200   AppParCurves_Constraint mylastC;
201   AppParCurves_Constraint realfirstC;
202   AppParCurves_Constraint reallastC;
203   Standard_Integer mycont;
204   Standard_Real mylambda1;
205   Standard_Real mylambda2;
206   Standard_Boolean myPeriodic;
207
208
209 };
210
211
212
213
214
215
216
217 #endif // _GeomInt_TheComputeLineOfWLApprox_HeaderFile