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