b311480e |
1 | -- Created on: 1997-06-24 |
2 | -- Created by: Philippe MANGIN |
3 | -- Copyright (c) 1997-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 | class SweepApproximation from Approx |
24 | |
25 | ---Purpose: Approximation of an Surface S(u,v) |
26 | -- (and eventually associate 2d Curves) defined |
27 | -- by section's law. |
28 | -- |
29 | -- This surface is defined by a function F(u, v) |
30 | -- where Ft(u) = F(u, t) is a bspline curve. |
31 | -- To use this algorithme, you have to implement Ft(u) |
32 | -- as a derivative class of Approx_SweepFunction. |
33 | -- This algorithm can be used by blending, sweeping... |
34 | |
35 | |
36 | |
37 | uses Array2OfReal from TColStd, |
38 | HArray2OfReal from TColStd, |
39 | Array1OfReal from TColStd, |
40 | HArray1OfReal from TColStd, |
41 | Array1OfInteger from TColStd, |
42 | HArray1OfInteger from TColStd, |
43 | |
44 | Vec from gp, |
45 | Array1OfPnt2d from TColgp, |
46 | HArray1OfPnt2d from TColgp, |
47 | HArray1OfPnt from TColgp, |
48 | HArray1OfVec2d from TColgp, |
49 | HArray1OfVec from TColgp, |
50 | Array2OfPnt from TColgp, |
51 | HArray2OfPnt from TColgp, |
52 | |
53 | HArray1OfGTrsf2d from Approx, |
54 | SequenceOfArray1OfPnt2d from TColgp, |
55 | Shape from GeomAbs, |
56 | EvaluatorFunction from AdvApprox, |
57 | Cutting from AdvApprox, |
58 | SweepFunction from Approx |
59 | |
60 | raises NotDone from StdFail, |
61 | DomainError, |
62 | OutOfRange |
63 | |
64 | is |
65 | Create(Func : SweepFunction from Approx) |
66 | returns SweepApproximation from Approx; |
67 | |
68 | Perform(me : in out; |
69 | First, Last : Real; |
70 | Tol3d, BoundTol, Tol2d, TolAngular : Real; |
71 | Continuity : Shape = GeomAbs_C0; |
72 | Degmax : Integer = 11; |
73 | Segmax : Integer = 50) |
74 | ---Purpose: Perform the Approximation |
75 | -- [First, Last] : Approx_SweepApproximation.cdl |
76 | -- Tol3d : Tolerance to surface approximation |
77 | -- Tol2d : Tolerance used to perform curve approximation |
78 | -- Normaly the 2d curve are approximated with a |
79 | -- tolerance given by the resolution on support surfaces, |
80 | -- but if this tolerance is too large Tol2d is used. |
81 | -- TolAngular : Tolerance (in radian) to control the angle |
82 | -- beetween tangents on the section law and |
83 | -- tangent of iso-v on approximed surface |
84 | -- Continuity : The continuity in v waiting on the surface |
85 | -- Degmax : The maximum degree in v requiered on the surface |
86 | -- Segmax : The maximum number of span in v requiered on |
87 | -- the surface |
88 | -- Warning : The continuity ci can be obtained only if Ft is Ci |
89 | raises DomainError from Standard; |
90 | -- if <Continuity> not in {C0, C1, C2} |
91 | -- if <Degmax> < 2 or degmax > Geom_BSplineSurface::MaxDegree() |
92 | -- if <Segmax> < 1 |
93 | -- if one tolerance is <= 0 |
94 | |
95 | Approximation(me : in out; |
96 | OneDTol, TwoDTol, ThreeDTol : HArray1OfReal; |
97 | BounTol : Real; |
98 | First, Last : Real; |
99 | Continuity : Shape; |
100 | Degmax, Segmax : Integer; |
101 | TheApproxFunction : EvaluatorFunction from AdvApprox; |
102 | TheCuttingTool : Cutting from AdvApprox) |
103 | is private; |
104 | |
105 | Eval(me : in out; |
106 | Parameter : Real; |
107 | DerivativeRequest : Integer; |
108 | First, Last : Real; |
109 | Result : in out Real) |
110 | ---Purpose : The EvaluatorFunction from AdvApprox; |
111 | returns Integer from Standard; |
112 | |
113 | D0(me : in out; |
114 | Param: Real; |
115 | First, Last : Real; |
116 | Result:in out Real) |
117 | returns Boolean is private; |
118 | |
119 | D1(me : in out; |
120 | Param: Real; |
121 | First, Last : Real; |
122 | Result:in out Real) |
123 | returns Boolean is private; |
124 | |
125 | D2(me : in out; |
126 | Param: Real; |
127 | First, Last : Real; |
128 | Result:in out Real) |
129 | returns Boolean is private; |
130 | |
131 | |
132 | IsDone(me) |
133 | ---Purpose : returns if we have an result |
134 | returns Boolean from Standard |
135 | ---C++: inline |
136 | is static; |
137 | |
138 | |
139 | SurfShape(me; UDegree,VDegree : out Integer from Standard; |
140 | NbUPoles,NbVPoles: out Integer from Standard; |
141 | NbUKnots,NbVKnots: out Integer from Standard) |
142 | raises NotDone from StdFail |
143 | is static; |
144 | |
145 | |
146 | Surface(me; TPoles : out Array2OfPnt from TColgp; |
147 | TWeights : out Array2OfReal from TColStd; |
148 | TUKnots,TVKnots : out Array1OfReal from TColStd; |
149 | TUMults,TVMults : out Array1OfInteger from TColStd) |
150 | raises NotDone from StdFail |
151 | is static; |
152 | |
153 | |
154 | UDegree(me) |
155 | |
156 | returns Integer from Standard |
157 | ---C++: inline |
158 | |
159 | raises NotDone from StdFail |
160 | is static; |
161 | |
162 | |
163 | VDegree(me) |
164 | |
165 | returns Integer from Standard |
166 | ---C++: inline |
167 | |
168 | raises NotDone from StdFail |
169 | is static; |
170 | |
171 | |
172 | SurfPoles(me) |
173 | |
174 | returns Array2OfPnt from TColgp |
175 | ---C++: inline |
176 | ---C++: return const& |
177 | |
178 | raises NotDone from StdFail |
179 | is static; |
180 | |
181 | |
182 | SurfWeights(me) |
183 | |
184 | returns Array2OfReal from TColStd |
185 | ---C++: inline |
186 | ---C++: return const& |
187 | |
188 | raises NotDone from StdFail |
189 | is static; |
190 | |
191 | |
192 | SurfUKnots(me) |
193 | |
194 | returns Array1OfReal from TColStd |
195 | ---C++: inline |
196 | ---C++: return const& |
197 | |
198 | raises NotDone from StdFail |
199 | is static; |
200 | |
201 | |
202 | SurfVKnots(me) |
203 | |
204 | returns Array1OfReal from TColStd |
205 | ---C++: inline |
206 | ---C++: return const& |
207 | |
208 | raises NotDone from StdFail |
209 | is static; |
210 | |
211 | |
212 | SurfUMults(me) |
213 | |
214 | returns Array1OfInteger from TColStd |
215 | ---C++: inline |
216 | ---C++: return const& |
217 | |
218 | raises NotDone from StdFail |
219 | is static; |
220 | |
221 | |
222 | SurfVMults(me) |
223 | |
224 | returns Array1OfInteger from TColStd |
225 | ---C++: inline |
226 | ---C++: return const& |
227 | |
228 | raises NotDone from StdFail |
229 | is static; |
230 | |
231 | MaxErrorOnSurf (me) |
232 | ---Purpose: returns the maximum error in the suface approximation. |
233 | returns Real; |
234 | |
235 | |
236 | AverageErrorOnSurf(me) |
237 | ---Purpose: returns the average error in the suface approximation. |
238 | returns Real; |
239 | |
240 | |
241 | NbCurves2d(me) |
242 | |
243 | returns Integer from Standard |
244 | ---C++: inline |
245 | |
246 | raises NotDone from StdFail |
247 | is static; |
248 | |
249 | |
250 | Curves2dShape(me; Degree,NbPoles,NbKnots: out Integer from Standard) |
251 | |
252 | raises NotDone from StdFail, |
253 | DomainError from Standard |
254 | |
255 | is static; |
256 | |
257 | |
258 | Curve2d(me; Index: Integer from Standard; |
259 | TPoles : out Array1OfPnt2d from TColgp; |
260 | TKnots : out Array1OfReal from TColStd; |
261 | TMults : out Array1OfInteger from TColStd) |
262 | |
263 | raises NotDone from StdFail, |
264 | OutOfRange from Standard, |
265 | DomainError from Standard |
266 | |
267 | is static; |
268 | |
269 | |
270 | Curves2dDegree(me) |
271 | |
272 | returns Integer from Standard |
273 | ---C++: inline |
274 | |
275 | raises NotDone from StdFail, |
276 | DomainError from Standard |
277 | is static; |
278 | |
279 | |
280 | Curve2dPoles(me; Index: Integer from Standard) |
281 | |
282 | returns Array1OfPnt2d from TColgp |
283 | ---C++: inline |
284 | ---C++: return const& |
285 | |
286 | raises NotDone from StdFail, |
287 | OutOfRange from Standard, |
288 | DomainError from Standard |
289 | is static; |
290 | |
291 | |
292 | Curves2dKnots(me) |
293 | |
294 | returns Array1OfReal from TColStd |
295 | ---C++: inline |
296 | ---C++: return const& |
297 | |
298 | raises NotDone from StdFail, |
299 | DomainError from Standard |
300 | is static; |
301 | |
302 | |
303 | Curves2dMults(me) |
304 | |
305 | returns Array1OfInteger from TColStd |
306 | ---C++: inline |
307 | ---C++: return const& |
308 | |
309 | raises NotDone from StdFail, |
310 | DomainError from Standard |
311 | is static; |
312 | |
313 | |
314 | Max2dError (me; Index : Integer) |
315 | ---Purpose: returns the maximum error of the <Index> |
316 | -- 2d curve approximation. |
317 | returns Real; |
318 | |
319 | |
320 | Average2dError(me; Index : Integer ) |
321 | ---Purpose: returns the average error of the <Index> |
322 | -- 2d curve approximation. |
323 | returns Real; |
324 | |
325 | TolCurveOnSurf(me; Index : Integer from Standard) |
326 | ---Purpose: returns the maximum 3d error of the <Index> |
327 | -- 2d curve approximation on the Surface. |
328 | returns Real from Standard |
329 | raises NotDone from StdFail |
330 | is static; |
331 | |
332 | Dump(me; o: in out OStream); |
333 | ---Purpose: display information on approximation. |
334 | |
335 | fields |
336 | myFunc : SweepFunction from Approx; |
337 | done : Boolean from Standard; |
338 | Num1DSS : Integer from Standard; |
339 | Num2DSS : Integer from Standard; |
340 | Num3DSS : Integer from Standard; |
341 | |
342 | udeg : Integer from Standard; |
343 | vdeg : Integer from Standard; |
344 | deg2d : Integer from Standard; |
345 | tabPoles : HArray2OfPnt from TColgp; |
346 | tabWeights: HArray2OfReal from TColStd; |
347 | tabUKnots : HArray1OfReal from TColStd; |
348 | tabVKnots : HArray1OfReal from TColStd; |
349 | tab2dKnots: HArray1OfReal from TColStd; |
350 | tabUMults : HArray1OfInteger from TColStd; |
351 | tabVMults : HArray1OfInteger from TColStd; |
352 | tab2dMults: HArray1OfInteger from TColStd; |
353 | seqPoles2d: SequenceOfArray1OfPnt2d from TColgp; |
354 | MError1d : HArray1OfReal from TColStd; |
355 | tab2dError: HArray1OfReal from TColStd; |
356 | MError3d : HArray1OfReal from TColStd; |
357 | AError1d : HArray1OfReal from TColStd; |
358 | Ave2dError: HArray1OfReal from TColStd; |
359 | AError3d : HArray1OfReal from TColStd; |
360 | AAffin : HArray1OfGTrsf2d from Approx; |
361 | COnSurfErr: HArray1OfReal from TColStd; |
362 | Translation : Vec from gp; |
363 | -- |
364 | -- To Accelerate Evaluation : |
365 | -- |
366 | myPoles : HArray1OfPnt; |
367 | myPoles2d : HArray1OfPnt2d; |
368 | myWeigths : HArray1OfReal; |
369 | myDPoles : HArray1OfVec; |
370 | myD2Poles : HArray1OfVec; |
371 | myDPoles2d : HArray1OfVec2d; |
372 | myD2Poles2d: HArray1OfVec2d; |
373 | myDWeigths : HArray1OfReal; |
374 | myD2Weigths: HArray1OfReal; |
375 | |
376 | myOrder : Integer; |
377 | myParam : Real; |
378 | first, last: Real; |
379 | end SweepApproximation; |