0022550: Fixing data races
[occt.git] / src / Approx / Approx_ComputeLine.cdl
1 -- File:        Approx_ComputeLine.cdl
2 -- Created:     Tue Jan 26 11:50:18 1993
3 -- Author:      Laurent PAINNOT
4 --              <lpa@sdsun1>
5 ---Copyright:    Matra Datavision 1993
6
7
8
9 generic class ComputeLine from Approx 
10                     (MultiLine as any;
11                      LineTool  as any) --as TheLineTool(MultiLine)
12
13
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,
25      Vector                    from math
26      
27      
28
29 private class MyGradient instantiates Gradient from AppParCurves
30                                        (MultiLine,
31                                         LineTool);
32                                                           
33 is
34
35
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 =
44            Approx_ChordLength;
45            Squares:         Boolean = Standard_False)
46            
47         ---Purpose: The MultiLine <Line> will be approximated until tolerances
48         --          will be reached.
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.
53
54     returns ComputeLine;
55
56
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)
66            
67         ---Purpose: The MultiLine <Line> will be approximated until tolerances
68         --          will be reached.
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.
73
74     returns ComputeLine;
75
76
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)
85            
86         ---Purpose: Initializes the fields of the algorithm.
87
88     returns ComputeLine;
89
90
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 =
98            Approx_ChordLength;
99            Squares:      Boolean = Standard_False)
100            
101         ---Purpose: Initializes the fields of the algorithm.
102
103     returns ComputeLine;
104
105
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 =
113                      Approx_ChordLength;
114                      Squares:      Boolean = Standard_False)
115            
116         ---Purpose: Initializes the fields of the algorithm.
117
118     is static;
119
120
121
122
123     Perform(me: in out; Line: MultiLine)
124         ---Purpose: runs the algorithm after having initialized the fields.
125     
126     is static;
127
128
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.
132
133     returns Boolean
134     is static private;
135     
136     
137     ComputeCurve(me: in out; Line: MultiLine; firspt, lastpt: Integer) 
138         ---Purpose: is internally used in the algorithm.
139     
140     returns Boolean
141     is static private;
142     
143     
144     Parameters(me; Line: MultiLine; firstP, LastP: Integer;
145                TheParameters: in out Vector)
146         ---Purpose: computes new parameters between firstP and lastP.
147
148     is static private;
149     
150     
151     SetDegrees(me: in out; degreemin, degreemax: Integer)
152         ---Purpose: changes the degrees of the approximation.
153     
154     is static;
155     
156     
157     SetTolerances(me: in out; Tolerance3d, Tolerance2d: Real)
158         ---Purpose: Changes the tolerances of the approximation.
159     
160     is static;
161     
162
163     SetConstraints(me: in out; firstC, lastC: Constraint from AppParCurves)
164             ---Purpose: changes the first and the last constraint points.
165     is static;
166
167
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.
172     
173     returns Boolean
174     is static;
175     
176
177     IsToleranceReached(me)
178         ---Purpose: returns False if the status NoPointsAdded has been sent.
179     
180     returns Boolean
181     is static;
182     
183
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.
186
187     is static;
188     
189
190     NbMultiCurves(me)
191         ---Purpose: Returns the number of MultiCurve doing the approximation
192         --          of the MultiLine.
193     returns Integer
194     is static;
195
196
197     Value(me; Index: Integer = 1)
198         ---Purpose: returns the result of the approximation.
199         ---C++: return const&
200     returns MultiCurve from AppParCurves
201     is static;
202
203     ChangeValue(me: in out; Index: Integer = 1)
204         ---Purpose: returns the result of the approximation.
205         ---C++: return &
206     returns MultiCurve from AppParCurves
207     is static;
208
209
210     SplineValue(me: in out)
211         ---Purpose: returns the result of the approximation.
212         ---C++: return const&
213     returns MultiBSpCurve from AppParCurves
214     is static;
215
216     Parametrization(me; partype :  in  out ParametrizationType from Approx) 
217         ---Purpose: returns the type  of  parametrization
218     is static;
219
220
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
226     is static;
227  
228      
229     
230     SearchFirstLambda(me; Line: MultiLine; Para: Vector; 
231                       V: Vector; index: Integer)
232     returns Real
233     is static private;
234     
235     SearchLastLambda(me: ; Line: MultiLine; Para: Vector;
236                      V: Vector; index: Integer)
237     returns Real
238     is static private;
239     
240     FirstTangencyVector(me; Line: MultiLine; index: Integer; V: in out Vector)
241     is static private;
242     
243     LastTangencyVector(me; Line: MultiLine; index: Integer; V: in out Vector)
244     is static private;
245
246
247 fields
248
249
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;
275
276 end ComputeLine;