b311480e |
1 | -- Created on: 1993-09-22 |
2 | -- Created by: Modelistation |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | generic class BSplComputeLine from Approx |
18 | (MultiLine as any; |
19 | LineTool as any) --as TheLineTool(MultiLine) |
20 | |
21 | |
22 | |
23 | uses ParametrizationType from Approx, |
24 | SequenceOfReal from TColStd, |
25 | HArray1OfReal from TColStd, |
26 | HArray1OfInteger from TColStd, |
27 | Array1OfReal from TColStd, |
28 | Array1OfInteger from TColStd, |
29 | HArray1OfConstraintCouple from AppParCurves, |
30 | Constraint from AppParCurves, |
31 | MultiBSpCurve from AppParCurves, |
32 | MultiCurve from AppParCurves, |
33 | Vector from math |
34 | |
35 | |
36 | |
37 | private class MyBSplGradient instantiates BSpGradient from AppParCurves |
38 | (MultiLine, |
39 | LineTool); |
40 | |
41 | |
42 | private class MyGradientbis instantiates Gradient from AppParCurves |
43 | (MultiLine, |
44 | LineTool); |
45 | |
46 | is |
47 | |
48 | |
49 | Create(Line: MultiLine; |
50 | degreemin: Integer = 4; |
51 | degreemax: Integer = 8; |
52 | Tolerance3d: Real = 1.0e-3; |
53 | Tolerance2d: Real = 1.0e-6; |
54 | NbIterations: Integer = 5; |
55 | cutting: Boolean = Standard_True; |
56 | parametrization: ParametrizationType from Approx = |
57 | Approx_ChordLength; |
58 | Squares: Boolean = Standard_False) |
59 | |
60 | ---Purpose: The MultiLine <Line> will be approximated until tolerances |
61 | -- will be reached. |
62 | -- The approximation will be done from degreemin to degreemax |
63 | -- with a cutting if the corresponding boolean is True. |
64 | -- If <Squares> is True, the computation will be done with |
65 | -- no iteration at all. |
66 | -- |
67 | -- The multiplicities of the internal knots is set by |
68 | -- default. |
69 | |
70 | returns BSplComputeLine; |
71 | |
72 | |
73 | Create(Line: MultiLine; |
74 | Parameters: Vector from math; |
75 | degreemin: Integer = 4; |
76 | degreemax: Integer = 8; |
77 | Tolerance3d: Real = 1.0e-03; |
78 | Tolerance2d: Real = 1.0e-06; |
79 | NbIterations: Integer = 5; |
80 | cutting: Boolean = Standard_True; |
81 | Squares: Boolean = Standard_False) |
82 | |
83 | ---Purpose: The MultiLine <Line> will be approximated until tolerances |
84 | -- will be reached. |
85 | -- The approximation will be done from degreemin to degreemax |
86 | -- with a cutting if the corresponding boolean is True. |
87 | -- If <Squares> is True, the computation will be done with |
88 | -- no iteration at all. |
89 | |
90 | returns BSplComputeLine; |
91 | |
92 | |
93 | Create(Parameters: Vector from math; |
94 | degreemin: Integer = 4; |
95 | degreemax: Integer = 8; |
96 | Tolerance3d: Real = 1.0e-03; |
97 | Tolerance2d: Real = 1.0e-06; |
98 | NbIterations: Integer = 5; |
99 | cutting: Boolean = Standard_True; |
100 | Squares: Boolean = Standard_False) |
101 | |
102 | ---Purpose: Initializes the fields of the algorithm. |
103 | |
104 | returns BSplComputeLine; |
105 | |
106 | |
107 | Create(degreemin: Integer = 4; |
108 | degreemax: Integer = 8; |
109 | Tolerance3d: Real = 1.0e-03; |
110 | Tolerance2d: Real = 1.0e-06; |
111 | NbIterations: Integer = 5; |
112 | cutting: Boolean = Standard_True; |
113 | parametrization: ParametrizationType from Approx = |
114 | Approx_ChordLength; |
115 | Squares: Boolean = Standard_False) |
116 | |
117 | ---Purpose: Initializes the fields of the algorithm. |
118 | |
119 | returns BSplComputeLine; |
120 | |
121 | |
122 | Interpol(me: in out; Line: MultiLine) |
123 | ---Purpose: Constructs an interpolation of the MultiLine <Line> |
124 | -- The result will be a C2 curve of degree 3. |
125 | is static; |
126 | |
127 | |
128 | |
129 | Init(me: in out; degreemin: Integer = 4; |
130 | degreemax: Integer = 8; |
131 | Tolerance3d: Real = 1.0e-03; |
132 | Tolerance2d: Real = 1.0e-06; |
133 | NbIterations: Integer = 5; |
134 | cutting: Boolean = Standard_True; |
135 | parametrization: ParametrizationType from Approx = |
136 | Approx_ChordLength; |
137 | Squares: Boolean = Standard_False) |
138 | |
139 | ---Purpose: Initializes the fields of the algorithm. |
140 | |
141 | is static; |
142 | |
143 | |
144 | Perform(me: in out; Line: MultiLine) |
145 | ---Purpose: runs the algorithm after having initialized the fields. |
146 | |
147 | is static; |
148 | |
149 | |
150 | Compute(me: in out; Line: MultiLine; fpt, lpt: Integer; |
151 | Para: in out Vector from math; Knots: Array1OfReal; |
152 | Mults: in out Array1OfInteger) |
153 | ---Purpose: is internally used in the algorithm. |
154 | |
155 | returns Boolean |
156 | is static private; |
157 | |
158 | |
159 | ComputeCurve(me: in out; Line: MultiLine; firspt, lastpt: Integer) |
160 | ---Purpose: is internally used in the algorithm. |
161 | |
162 | returns Boolean |
163 | is static private; |
164 | |
165 | |
166 | Parameters(me; Line: MultiLine; firstP, LastP: Integer; |
167 | TheParameters: in out Vector) |
168 | ---Purpose: computes new parameters between firstP and lastP. |
169 | |
170 | is static private; |
171 | |
172 | |
173 | SetParameters(me: in out; ThePar: Vector from math) |
174 | ---Purpose: The approximation will begin with the |
175 | -- set of parameters <ThePar>. |
176 | is static; |
177 | |
178 | |
179 | SetKnots(me: in out; Knots: Array1OfReal from TColStd) |
180 | ---Purpose: The approximation will be done with the |
181 | -- set of knots <Knots>. The multiplicities will be set |
182 | -- with the degree and the desired continuity. |
183 | is static; |
184 | |
185 | |
186 | SetKnotsAndMultiplicities(me: in out; |
187 | Knots: Array1OfReal from TColStd; |
188 | Mults: Array1OfInteger from TColStd) |
189 | ---Purpose: The approximation will be done with the |
190 | -- set of knots <Knots> and the multiplicities <Mults>. |
191 | is static; |
192 | |
193 | |
194 | SetDegrees(me: in out; degreemin, degreemax: Integer) |
195 | ---Purpose: changes the degrees of the approximation. |
196 | |
197 | is static; |
198 | |
199 | |
200 | SetTolerances(me: in out; Tolerance3d, Tolerance2d: Real) |
201 | ---Purpose: Changes the tolerances of the approximation. |
202 | |
203 | is static; |
204 | |
205 | |
206 | SetContinuity(me: in out; C: Integer) |
207 | ---Purpose: sets the continuity of the spline. |
208 | -- if C = 2, the spline will be C2. |
209 | |
210 | is static; |
211 | |
212 | |
213 | SetConstraints(me: in out; firstC, lastC: Constraint from AppParCurves) |
214 | ---Purpose: changes the first and the last constraint points. |
215 | is static; |
216 | |
217 | |
218 | IsAllApproximated(me) |
219 | ---Purpose: returns False if at a moment of the approximation, |
220 | -- the status NoApproximation has been sent by the user |
221 | -- when more points were needed. |
222 | |
223 | returns Boolean |
224 | is static; |
225 | |
226 | |
227 | IsToleranceReached(me) |
228 | ---Purpose: returns False if the status NoPointsAdded has been sent. |
229 | |
230 | returns Boolean |
231 | is static; |
232 | |
233 | |
234 | Error(me; tol3d: in out Real; tol2d: in out Real) |
235 | ---Purpose: returns the tolerances 2d and 3d of the MultiBSpCurve. |
236 | |
237 | is static; |
238 | |
239 | |
240 | Value(me) |
241 | ---Purpose: returns the result of the approximation. |
242 | ---C++: return const& |
243 | returns MultiBSpCurve from AppParCurves; |
244 | |
245 | |
246 | ChangeValue(me: in out) |
247 | ---Purpose: returns the result of the approximation. |
248 | ---C++: return & |
249 | returns MultiBSpCurve from AppParCurves; |
250 | |
251 | |
252 | |
253 | Parameters(me) |
254 | ---Purpose: returns the new parameters of the approximation |
255 | -- corresponding to the points of the MultiBSpCurve. |
256 | ---C++: return const& |
257 | returns Array1OfReal from TColStd |
258 | is static; |
259 | |
260 | |
261 | |
262 | SearchFirstLambda(me; Line: MultiLine; Para: Vector; |
263 | Knots: Array1OfReal from TColStd; |
264 | V: Vector; index: Integer) |
265 | returns Real |
266 | is static private; |
267 | |
268 | SearchLastLambda(me: ; Line: MultiLine; Para: Vector; |
269 | Knots: Array1OfReal from TColStd; |
270 | V: Vector; index: Integer) |
271 | returns Real |
272 | is static private; |
273 | |
274 | TangencyVector(me; Line: MultiLine; C: MultiCurve from AppParCurves; |
275 | U: Real from Standard; V: in out Vector from math) |
276 | is static private; |
277 | |
278 | |
279 | FirstTangencyVector(me; Line: MultiLine; index: Integer; V: out Vector) |
280 | is static private; |
281 | |
282 | LastTangencyVector(me; Line: MultiLine; index: Integer; V: out Vector) |
283 | is static private; |
284 | |
285 | FindRealConstraints(me: in out; Line: MultiLine) |
286 | is static private; |
287 | |
288 | fields |
289 | |
290 | TheMultiBSpCurve: MultiBSpCurve from AppParCurves; |
291 | alldone : Boolean from Standard; |
292 | tolreached : Boolean from Standard; |
293 | Par : ParametrizationType from Approx; |
294 | myParameters : HArray1OfReal from TColStd; |
295 | myfirstParam : HArray1OfReal from TColStd; |
296 | myknots : HArray1OfReal from TColStd; |
297 | mymults : HArray1OfInteger from TColStd; |
298 | myhasknots : Boolean from Standard; |
299 | myhasmults : Boolean from Standard; |
300 | myConstraints : HArray1OfConstraintCouple from AppParCurves; |
301 | mydegremin : Integer from Standard; |
302 | mydegremax : Integer from Standard; |
303 | mytol3d : Real from Standard; |
304 | mytol2d : Real from Standard; |
305 | currenttol3d : Real from Standard; |
306 | currenttol2d : Real from Standard; |
307 | mycut : Boolean from Standard; |
308 | mysquares : Boolean from Standard; |
309 | myitermax : Integer from Standard; |
310 | myfirstC : Constraint from AppParCurves; |
311 | mylastC : Constraint from AppParCurves; |
312 | realfirstC : Constraint from AppParCurves; |
313 | reallastC : Constraint from AppParCurves; |
314 | mycont : Integer from Standard; |
315 | mylambda1 : Real from Standard; |
316 | mylambda2 : Real from Standard; |
317 | |
318 | end BSplComputeLine; |