1 -- File: Approx_ComputeLine.cdl
2 -- Created: Tue Jan 26 11:50:18 1993
3 -- Author: Laurent PAINNOT
5 ---Copyright: Matra Datavision 1993
9 generic class ComputeLine from Approx
11 LineTool as any) --as TheLineTool(MultiLine)
14 uses ParametrizationType from Approx,
15 SequenceOfReal from TColStd,
16 HArray1OfReal from TColStd,
17 Array1OfReal from TColStd,
18 SequenceOfMultiCurve from AppParCurves,
19 HArray1OfMultiCurve from AppParCurves,
20 HArray1OfConstraintCouple from AppParCurves,
21 Constraint from AppParCurves,
22 SequenceOfHArray1OfReal from Approx,
23 MultiCurve from AppParCurves,
24 MultiBSpCurve from AppParCurves,
29 private class MyGradient instantiates Gradient from AppParCurves
36 Create(Line: MultiLine;
37 degreemin: Integer = 4;
38 degreemax: Integer = 8;
39 Tolerance3d: Real = 1.0e-3;
40 Tolerance2d: Real = 1.0e-6;
41 NbIterations: Integer = 5;
42 cutting: Boolean = Standard_True;
43 parametrization: ParametrizationType from Approx =
45 Squares: Boolean = Standard_False)
47 ---Purpose: The MultiLine <Line> will be approximated until tolerances
49 -- The approximation will be done from degreemin to degreemax
50 -- with a cutting if the corresponding boolean is True.
51 -- If <Squares> is True, the computation will be done with
52 -- no iteration at all.
57 Create(Line: MultiLine;
58 Parameters: Vector from math;
59 degreemin: Integer = 4;
60 degreemax: Integer = 8;
61 Tolerance3d: Real = 1.0e-03;
62 Tolerance2d: Real = 1.0e-06;
63 NbIterations: Integer = 5;
64 cutting: Boolean = Standard_True;
65 Squares: Boolean = Standard_False)
67 ---Purpose: The MultiLine <Line> will be approximated until tolerances
69 -- The approximation will be done from degreemin to degreemax
70 -- with a cutting if the corresponding boolean is True.
71 -- If <Squares> is True, the computation will be done with
72 -- no iteration at all.
77 Create(Parameters: Vector from math;
78 degreemin: Integer = 4;
79 degreemax: Integer = 8;
80 Tolerance3d: Real = 1.0e-03;
81 Tolerance2d: Real = 1.0e-06;
82 NbIterations: Integer = 5;
83 cutting: Boolean = Standard_True;
84 Squares: Boolean = Standard_False)
86 ---Purpose: Initializes the fields of the algorithm.
91 Create(degreemin: Integer = 4;
92 degreemax: Integer = 8;
93 Tolerance3d: Real = 1.0e-03;
94 Tolerance2d: Real = 1.0e-06;
95 NbIterations: Integer = 5;
96 cutting: Boolean = Standard_True;
97 parametrization: ParametrizationType from Approx =
99 Squares: Boolean = Standard_False)
101 ---Purpose: Initializes the fields of the algorithm.
106 Init(me: in out; degreemin: Integer = 4;
107 degreemax: Integer = 8;
108 Tolerance3d: Real = 1.0e-03;
109 Tolerance2d: Real = 1.0e-06;
110 NbIterations: Integer = 5;
111 cutting: Boolean = Standard_True;
112 parametrization: ParametrizationType from Approx =
114 Squares: Boolean = Standard_False)
116 ---Purpose: Initializes the fields of the algorithm.
123 Perform(me: in out; Line: MultiLine)
124 ---Purpose: runs the algorithm after having initialized the fields.
129 Compute(me: in out; Line: MultiLine; fpt, lpt: Integer;
130 Para: in out Vector from math; TheTol3d, TheTol2d: in out Real)
131 ---Purpose: is internally used in the algorithm.
137 ComputeCurve(me: in out; Line: MultiLine; firspt, lastpt: Integer)
138 ---Purpose: is internally used in the algorithm.
144 Parameters(me; Line: MultiLine; firstP, LastP: Integer;
145 TheParameters: in out Vector)
146 ---Purpose: computes new parameters between firstP and lastP.
151 SetDegrees(me: in out; degreemin, degreemax: Integer)
152 ---Purpose: changes the degrees of the approximation.
157 SetTolerances(me: in out; Tolerance3d, Tolerance2d: Real)
158 ---Purpose: Changes the tolerances of the approximation.
163 SetConstraints(me: in out; firstC, lastC: Constraint from AppParCurves)
164 ---Purpose: changes the first and the last constraint points.
168 IsAllApproximated(me)
169 ---Purpose: returns False if at a moment of the approximation,
170 -- the status NoApproximation has been sent by the user
171 -- when more points were needed.
177 IsToleranceReached(me)
178 ---Purpose: returns False if the status NoPointsAdded has been sent.
184 Error(me; Index: Integer; tol3d: in out Real; tol2d: in out Real)
185 ---Purpose: returns the tolerances 2d and 3d of the <Index> MultiCurve.
191 ---Purpose: Returns the number of MultiCurve doing the approximation
197 Value(me; Index: Integer = 1)
198 ---Purpose: returns the result of the approximation.
199 ---C++: return const&
200 returns MultiCurve from AppParCurves
203 ChangeValue(me: in out; Index: Integer = 1)
204 ---Purpose: returns the result of the approximation.
206 returns MultiCurve from AppParCurves
210 SplineValue(me: in out)
211 ---Purpose: returns the result of the approximation.
212 ---C++: return const&
213 returns MultiBSpCurve from AppParCurves
216 Parametrization(me; partype : in out ParametrizationType from Approx)
217 ---Purpose: returns the type of parametrization
221 Parameters(me; Index: Integer = 1)
222 ---Purpose: returns the new parameters of the approximation
223 -- corresponding to the points of the multicurve <Index>.
224 ---C++: return const&
225 returns Array1OfReal from TColStd
230 SearchFirstLambda(me; Line: MultiLine; Para: Vector;
231 V: Vector; index: Integer)
235 SearchLastLambda(me: ; Line: MultiLine; Para: Vector;
236 V: Vector; index: Integer)
240 FirstTangencyVector(me; Line: MultiLine; index: Integer; V: in out Vector)
243 LastTangencyVector(me; Line: MultiLine; index: Integer; V: in out Vector)
250 myMultiCurves: SequenceOfMultiCurve from AppParCurves;
251 TheMultiCurve: MultiCurve from AppParCurves;
252 myspline : MultiBSpCurve from AppParCurves;
253 alldone: Boolean from Standard;
254 tolreached: Boolean from Standard;
255 Par: ParametrizationType from Approx;
256 myParameters: HArray1OfReal from TColStd;
257 myfirstParam: HArray1OfReal from TColStd;
258 myPar: SequenceOfHArray1OfReal from Approx;
259 Tolers3d: SequenceOfReal from TColStd;
260 Tolers2d: SequenceOfReal from TColStd;
261 myConstraints: HArray1OfConstraintCouple from AppParCurves;
262 mydegremin: Integer from Standard;
263 mydegremax: Integer from Standard;
264 mytol3d: Real from Standard;
265 mytol2d: Real from Standard;
266 currenttol3d: Real from Standard;
267 currenttol2d: Real from Standard;
268 mycut: Boolean from Standard;
269 mysquares: Boolean from Standard;
270 myitermax: Integer from Standard;
271 myfirstC: Constraint from AppParCurves;
272 mylastC: Constraint from AppParCurves;
273 myMultiLineNb: Integer from Standard;
274 myIsClear : Boolean from Standard;