1 -- Created on: 1997-06-24
2 -- Created by: Philippe MANGIN
3 -- Copyright (c) 1997-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class SweepApproximation from Approx
19 ---Purpose: Approximation of an Surface S(u,v)
20 -- (and eventually associate 2d Curves) defined
23 -- This surface is defined by a function F(u, v)
24 -- where Ft(u) = F(u, t) is a bspline curve.
25 -- To use this algorithme, you have to implement Ft(u)
26 -- as a derivative class of Approx_SweepFunction.
27 -- This algorithm can be used by blending, sweeping...
31 uses Array2OfReal from TColStd,
32 HArray2OfReal from TColStd,
33 Array1OfReal from TColStd,
34 HArray1OfReal from TColStd,
35 Array1OfInteger from TColStd,
36 HArray1OfInteger from TColStd,
39 Array1OfPnt2d from TColgp,
40 HArray1OfPnt2d from TColgp,
41 HArray1OfPnt from TColgp,
42 HArray1OfVec2d from TColgp,
43 HArray1OfVec from TColgp,
44 Array2OfPnt from TColgp,
45 HArray2OfPnt from TColgp,
47 HArray1OfGTrsf2d from Approx,
48 SequenceOfArray1OfPnt2d from TColgp,
50 EvaluatorFunction from AdvApprox,
51 Cutting from AdvApprox,
52 SweepFunction from Approx
54 raises NotDone from StdFail,
59 Create(Func : SweepFunction from Approx)
60 returns SweepApproximation from Approx;
64 Tol3d, BoundTol, Tol2d, TolAngular : Real;
65 Continuity : Shape = GeomAbs_C0;
66 Degmax : Integer = 11;
67 Segmax : Integer = 50)
68 ---Purpose: Perform the Approximation
69 -- [First, Last] : Approx_SweepApproximation.cdl
70 -- Tol3d : Tolerance to surface approximation
71 -- Tol2d : Tolerance used to perform curve approximation
72 -- Normaly the 2d curve are approximated with a
73 -- tolerance given by the resolution on support surfaces,
74 -- but if this tolerance is too large Tol2d is used.
75 -- TolAngular : Tolerance (in radian) to control the angle
76 -- beetween tangents on the section law and
77 -- tangent of iso-v on approximed surface
78 -- Continuity : The continuity in v waiting on the surface
79 -- Degmax : The maximum degree in v requiered on the surface
80 -- Segmax : The maximum number of span in v requiered on
82 -- Warning : The continuity ci can be obtained only if Ft is Ci
83 raises DomainError from Standard;
84 -- if <Continuity> not in {C0, C1, C2}
85 -- if <Degmax> < 2 or degmax > Geom_BSplineSurface::MaxDegree()
87 -- if one tolerance is <= 0
89 Approximation(me : in out;
90 OneDTol, TwoDTol, ThreeDTol : HArray1OfReal;
94 Degmax, Segmax : Integer;
95 TheApproxFunction : EvaluatorFunction from AdvApprox;
96 TheCuttingTool : Cutting from AdvApprox)
101 DerivativeRequest : Integer;
103 Result : in out Real)
104 ---Purpose : The EvaluatorFunction from AdvApprox;
105 returns Integer from Standard;
111 returns Boolean is private;
117 returns Boolean is private;
123 returns Boolean is private;
127 ---Purpose : returns if we have an result
128 returns Boolean from Standard
133 SurfShape(me; UDegree,VDegree : out Integer from Standard;
134 NbUPoles,NbVPoles: out Integer from Standard;
135 NbUKnots,NbVKnots: out Integer from Standard)
136 raises NotDone from StdFail
140 Surface(me; TPoles : out Array2OfPnt from TColgp;
141 TWeights : out Array2OfReal from TColStd;
142 TUKnots,TVKnots : out Array1OfReal from TColStd;
143 TUMults,TVMults : out Array1OfInteger from TColStd)
144 raises NotDone from StdFail
150 returns Integer from Standard
153 raises NotDone from StdFail
159 returns Integer from Standard
162 raises NotDone from StdFail
168 returns Array2OfPnt from TColgp
170 ---C++: return const&
172 raises NotDone from StdFail
178 returns Array2OfReal from TColStd
180 ---C++: return const&
182 raises NotDone from StdFail
188 returns Array1OfReal from TColStd
190 ---C++: return const&
192 raises NotDone from StdFail
198 returns Array1OfReal from TColStd
200 ---C++: return const&
202 raises NotDone from StdFail
208 returns Array1OfInteger from TColStd
210 ---C++: return const&
212 raises NotDone from StdFail
218 returns Array1OfInteger from TColStd
220 ---C++: return const&
222 raises NotDone from StdFail
226 ---Purpose: returns the maximum error in the suface approximation.
230 AverageErrorOnSurf(me)
231 ---Purpose: returns the average error in the suface approximation.
237 returns Integer from Standard
240 raises NotDone from StdFail
244 Curves2dShape(me; Degree,NbPoles,NbKnots: out Integer from Standard)
246 raises NotDone from StdFail,
247 DomainError from Standard
252 Curve2d(me; Index: Integer from Standard;
253 TPoles : out Array1OfPnt2d from TColgp;
254 TKnots : out Array1OfReal from TColStd;
255 TMults : out Array1OfInteger from TColStd)
257 raises NotDone from StdFail,
258 OutOfRange from Standard,
259 DomainError from Standard
266 returns Integer from Standard
269 raises NotDone from StdFail,
270 DomainError from Standard
274 Curve2dPoles(me; Index: Integer from Standard)
276 returns Array1OfPnt2d from TColgp
278 ---C++: return const&
280 raises NotDone from StdFail,
281 OutOfRange from Standard,
282 DomainError from Standard
288 returns Array1OfReal from TColStd
290 ---C++: return const&
292 raises NotDone from StdFail,
293 DomainError from Standard
299 returns Array1OfInteger from TColStd
301 ---C++: return const&
303 raises NotDone from StdFail,
304 DomainError from Standard
308 Max2dError (me; Index : Integer)
309 ---Purpose: returns the maximum error of the <Index>
310 -- 2d curve approximation.
314 Average2dError(me; Index : Integer )
315 ---Purpose: returns the average error of the <Index>
316 -- 2d curve approximation.
319 TolCurveOnSurf(me; Index : Integer from Standard)
320 ---Purpose: returns the maximum 3d error of the <Index>
321 -- 2d curve approximation on the Surface.
322 returns Real from Standard
323 raises NotDone from StdFail
326 Dump(me; o: in out OStream);
327 ---Purpose: display information on approximation.
330 myFunc : SweepFunction from Approx;
331 done : Boolean from Standard;
332 Num1DSS : Integer from Standard;
333 Num2DSS : Integer from Standard;
334 Num3DSS : Integer from Standard;
336 udeg : Integer from Standard;
337 vdeg : Integer from Standard;
338 deg2d : Integer from Standard;
339 tabPoles : HArray2OfPnt from TColgp;
340 tabWeights: HArray2OfReal from TColStd;
341 tabUKnots : HArray1OfReal from TColStd;
342 tabVKnots : HArray1OfReal from TColStd;
343 tab2dKnots: HArray1OfReal from TColStd;
344 tabUMults : HArray1OfInteger from TColStd;
345 tabVMults : HArray1OfInteger from TColStd;
346 tab2dMults: HArray1OfInteger from TColStd;
347 seqPoles2d: SequenceOfArray1OfPnt2d from TColgp;
348 MError1d : HArray1OfReal from TColStd;
349 tab2dError: HArray1OfReal from TColStd;
350 MError3d : HArray1OfReal from TColStd;
351 AError1d : HArray1OfReal from TColStd;
352 Ave2dError: HArray1OfReal from TColStd;
353 AError3d : HArray1OfReal from TColStd;
354 AAffin : HArray1OfGTrsf2d from Approx;
355 COnSurfErr: HArray1OfReal from TColStd;
356 Translation : Vec from gp;
358 -- To Accelerate Evaluation :
360 myPoles : HArray1OfPnt;
361 myPoles2d : HArray1OfPnt2d;
362 myWeigths : HArray1OfReal;
363 myDPoles : HArray1OfVec;
364 myD2Poles : HArray1OfVec;
365 myDPoles2d : HArray1OfVec2d;
366 myD2Poles2d: HArray1OfVec2d;
367 myDWeigths : HArray1OfReal;
368 myD2Weigths: HArray1OfReal;
373 end SweepApproximation;