0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Approx / Approx_SweepApproximation.cdl
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
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
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.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class SweepApproximation from Approx 
18
19         ---Purpose:  Approximation  of  an  Surface   S(u,v) 
20         --          (and eventually associate  2d Curves) defined
21         --           by section's law.
22         --          
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...
28         
29        
30
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,
37        
38      Vec                     from gp,
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, 
46        
47      HArray1OfGTrsf2d        from Approx,      
48      SequenceOfArray1OfPnt2d from TColgp, 
49      Shape                   from GeomAbs, 
50      EvaluatorFunction       from AdvApprox,
51      Cutting                 from AdvApprox,     
52      SweepFunction           from Approx
53
54 raises NotDone     from StdFail,
55        DomainError,
56        OutOfRange  
57
58 is
59     Create(Func :   SweepFunction from Approx)           
60     returns SweepApproximation from Approx; 
61
62     Perform(me  :  in  out; 
63             First,  Last  :  Real;
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 
81            --                 the surface 
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()
86         -- if <Segmax> < 1
87         -- if one tolerance is <= 0
88         
89     Approximation(me : in out;
90                   OneDTol,  TwoDTol, ThreeDTol : HArray1OfReal; 
91                   BounTol                      : Real;
92                   First, Last                  : Real;
93                   Continuity                   : Shape;
94                   Degmax, Segmax               : Integer;
95                   TheApproxFunction  : EvaluatorFunction from AdvApprox;
96                   TheCuttingTool     : Cutting from AdvApprox)
97             is private;     
98                   
99     Eval(me : in out; 
100          Parameter         : Real;
101          DerivativeRequest : Integer;
102          First, Last       : Real;
103          Result            : in out  Real)
104     ---Purpose : The EvaluatorFunction from AdvApprox;   
105     returns Integer from Standard; 
106      
107    D0(me : in out; 
108       Param: Real;
109       First, Last : Real;
110       Result:in out Real)
111    returns Boolean  is  private;
112         
113    D1(me : in out;
114       Param: Real;
115       First, Last : Real;
116       Result:in out Real)
117    returns Boolean  is private;
118    
119     D2(me : in out;
120       Param: Real;
121       First, Last : Real;
122       Result:in out Real)
123    returns Boolean  is  private;
124      
125         
126     IsDone(me)
127     ---Purpose : returns if we have an result
128         returns Boolean from Standard
129         ---C++: inline  
130         is static;
131
132
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
137         is static;
138
139
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
145         is static;
146
147
148     UDegree(me)
149     
150         returns Integer from Standard
151         ---C++: inline
152
153         raises NotDone from StdFail
154         is static;
155
156
157     VDegree(me)
158     
159         returns Integer from Standard
160         ---C++: inline
161
162         raises NotDone from StdFail
163         is static;
164
165
166     SurfPoles(me)
167     
168         returns Array2OfPnt from TColgp
169         ---C++: inline
170         ---C++: return const&
171
172         raises NotDone from StdFail
173         is static;
174
175
176     SurfWeights(me)
177     
178         returns Array2OfReal from TColStd
179         ---C++: inline
180         ---C++: return const&
181
182         raises NotDone from StdFail
183         is static;
184
185
186     SurfUKnots(me)
187     
188         returns Array1OfReal from TColStd
189         ---C++: inline
190         ---C++: return const&
191
192         raises NotDone from StdFail
193         is static;
194
195
196     SurfVKnots(me)
197     
198         returns Array1OfReal from TColStd
199         ---C++: inline
200         ---C++: return const&
201
202         raises NotDone from StdFail
203         is static;
204
205
206     SurfUMults(me)
207     
208         returns Array1OfInteger from TColStd
209         ---C++: inline
210         ---C++: return const&
211
212         raises NotDone from StdFail
213         is static;
214
215
216     SurfVMults(me)
217     
218         returns Array1OfInteger from TColStd
219         ---C++: inline
220         ---C++: return const&
221
222         raises NotDone from StdFail
223         is static;
224         
225     MaxErrorOnSurf (me) 
226     ---Purpose: returns the maximum error in the suface approximation.
227     returns Real; 
228
229     
230     AverageErrorOnSurf(me)
231     ---Purpose: returns the average error in the suface approximation.     
232     returns Real;
233
234
235     NbCurves2d(me)
236     
237         returns Integer from Standard
238         ---C++: inline
239         
240         raises NotDone from StdFail
241         is static;
242
243
244     Curves2dShape(me; Degree,NbPoles,NbKnots: out Integer from Standard)
245     
246         raises NotDone from StdFail,
247                DomainError from Standard
248
249         is static;
250         
251         
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)
256                 
257         raises NotDone     from StdFail,
258                OutOfRange  from Standard,
259                DomainError from Standard
260
261         is static;     
262
263
264     Curves2dDegree(me)
265     
266         returns Integer from Standard
267         ---C++: inline
268         
269         raises NotDone from StdFail,
270                DomainError from Standard
271         is static;
272         
273         
274     Curve2dPoles(me; Index: Integer from Standard)
275     
276         returns Array1OfPnt2d from TColgp
277         ---C++: inline
278         ---C++: return const&
279         
280         raises NotDone     from StdFail,
281                OutOfRange  from Standard,
282                DomainError from Standard
283         is static;
284         
285
286     Curves2dKnots(me)
287     
288         returns Array1OfReal from TColStd
289         ---C++: inline
290         ---C++: return const&
291
292         raises NotDone from StdFail,
293                DomainError from Standard
294         is static;
295
296
297     Curves2dMults(me)
298     
299         returns Array1OfInteger from TColStd
300         ---C++: inline
301         ---C++: return const&
302
303         raises NotDone from StdFail,
304                DomainError from Standard
305         is static;
306         
307         
308     Max2dError (me; Index : Integer) 
309     ---Purpose: returns the maximum error of the <Index> 
310     --          2d curve approximation.
311     returns Real; 
312
313     
314     Average2dError(me; Index : Integer )
315     ---Purpose: returns the average error of the <Index> 
316     --          2d curve approximation.
317     returns Real;        
318      
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
324     is static;    
325     
326     Dump(me; o: in out OStream);
327     ---Purpose: display information on approximation.
328
329 fields
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; 
335        
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;
357 --    
358 --         To  Accelerate  Evaluation  :
359 --          
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;
369
370  myOrder    :  Integer;
371  myParam    :  Real;
372  first, last:  Real; 
373 end SweepApproximation;