0023952: Improving thread-safety of intersections, approximations and other modeling...
[occt.git] / src / IntWalk / IntWalk_PWalking.cdl
1 -- Created on: 1992-04-03
2 -- Created by: Isabelle GRIGNON
3 -- Copyright (c) 1992-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
21
22
23 generic class PWalking from IntWalk (
24     ThePSurface           as any;
25     ThePSurfaceTool       as any) -- as PSurfaceTool from IntWalk(ThePSurface)
26
27     
28     ---Purpose: This class implements an algorithm to determine the
29     --          intersection between 2 parametrized surface, marching from
30     --          a starting point. The intersection line
31     --          starts and ends on the natural surface 's  boundaries .
32
33
34 uses XY                  from gp,
35      StatusDeflection    from IntWalk,
36      ConstIsoparametric  from IntImp,
37      Array1OfReal        from TColStd,
38      PntOn2S             from IntSurf,
39      LineOn2S            from IntSurf,
40      Dir                 from gp,
41      Dir2d               from gp
42      
43      
44 raises OutOfRange from Standard,
45        NotDone    from StdFail
46        
47
48     class TheInt2S instantiates Int2S from IntImp
49              (ThePSurface, ThePSurfaceTool);
50
51 is
52
53
54     Create ( Caro1 , 
55              Caro2       : ThePSurface ; 
56              TolTangency,
57              Epsilon,
58              Deflection,
59              Increment   : Real from Standard)
60             
61         ---Purpose: Constructor used to set the data to compute intersection
62         --          lines between Caro1 and Caro2.
63         --          Deflection is the maximum deflection admitted between two 
64         --          consecutive points on the resulting polyline.
65         --          TolTangency is the tolerance to find a tangent point.
66         --          Func is the criterion which has to be evaluated at each
67         --          solution point (each point of the line).
68         --          It is necessary to call the Perform method to compute 
69         --          the intersection lines.
70         --          la ligne trouvee part d'un point sur ou dans les 2 domaines
71         --          naturelles des surfaces .Elle peut etre fermee ;dans les 
72         --          cas standard si elle est ouverte elle s arrete  et commence
73         --          a une frontiere d 'un des domaines.Si une ligne ouverte 
74         --          s arrete en plein milieu d'un domaine ,on s'arrete sur 
75         --          point de tangence.
76         --          Epsilon  tolerance au carre de confusion de points      
77
78         returns PWalking;
79         
80
81     Create ( Caro1 , 
82              Caro2       : ThePSurface ; 
83              TolTangency,
84              Epsilon,
85              Deflection,
86              Increment   : Real from Standard;
87              U1,V1,U2,V2 :Real from Standard)
88             
89         ---Purpose: Returns the intersection line containing the exact
90         --          point Poin. This line is a polygonal line.
91         --          Deflection is the maximum deflection admitted between two 
92         --          consecutive points on the resulting polyline.
93         --          TolTangency is the tolerance to find a tangent point.
94         --          Func is the criterion which has to be evaluated at each
95         --          solution point (each point of the line).
96         --          la ligne trouvee part d'un point sur ou dans les 2 domaines
97         --          naturelles des surfaces .Elle peut etre fermee ;dans les 
98         --          cas standard si elle est ouverte elle s arrete  et commence
99         --          a une frontiere d 'un des domaines.Si une ligne ouverte 
100         --          s arrete en plein milieu d'un domaine ,on s'arrete sur 
101         --          point de tangence.
102         --          Epsilon  tolerance au carre de confusion de points      
103
104         returns PWalking;
105
106         
107     Perform(me :in out;ParDep : Array1OfReal  from TColStd)
108                        
109         ---Purpose: calcule la ligne d 'intersection
110
111         is static;
112
113     Perform(me :in out;ParDep : Array1OfReal  from TColStd;
114                 u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard)
115                        
116         ---Purpose: calcule  la  ligne d 'intersection le  reglage des
117         --          pas est fait a partir des valeurs min max sur u et
118         --           v.  (si ces donnees ne   sont pas presentes comme
119         --          dans la methode precedente, les pas initiaux sont
120         --          calcules a partir des min max uv des faces).
121
122         is static;
123
124
125     PerformFirstPoint(me :in out;
126                       ParDep    : Array1OfReal  from TColStd;
127                       FirstPoint: in out PntOn2S from IntSurf)
128     
129         ---Purpose: calcule le premier point d'une ligne d'intersection
130         --          
131
132         returns Boolean from Standard
133
134         is static;
135
136
137     IsDone(me)
138     
139         ---Purpose: Returns true if the calculus was successful.
140
141         returns Boolean from Standard
142         ---C++: inline
143
144         is static;
145
146
147     NbPoints(me)
148     
149         ---Purpose: Returns the number of points of the resulting polyline.
150         --          An exception is raised if IsDone returns False.
151
152         returns Integer from Standard
153         ---C++: inline
154
155         raises NotDone from StdFail
156
157         is static;
158
159
160     Value(me ; Index : Integer from Standard)
161     
162         ---Purpose: Returns the point of range Index on the polyline. 
163         --          An exception is raised if IsDone returns False.
164         --          An exception is raised if Index<=0 or Index>NbPoints.
165
166         returns  PntOn2S from IntSurf
167         ---C++: inline
168         ---C++: return const&
169
170         raises NotDone    from StdFail,
171                OutOfRange from Standard
172         
173         is static;
174
175
176     Line(me)
177     
178         returns mutable LineOn2S from IntSurf
179         ---C++: inline
180         ---C++: return const&
181         
182         raises NotDone from StdFail
183         is static;
184
185
186     TangentAtFirst(me)
187     
188         ---Purpose: Returns True if the surface are tangent at the first point
189         --          of the line.
190         --          An exception is raised if IsDone returns False.
191
192         returns Boolean from Standard
193         ---C++: inline
194
195         raises NotDone from StdFail
196
197         is static;
198
199
200     TangentAtLast(me)
201     
202         ---Purpose: Returns true if the surface are tangent at the last point
203         --          of the line.
204         --          An exception is raised if IsDone returns False.
205
206         returns Boolean from Standard
207         ---C++: inline
208         
209         raises NotDone from StdFail
210         is static;
211
212
213     IsClosed(me)
214     
215         ---Purpose: Returns True if the line is closed.
216         --          An exception is raised if IsDone returns False.
217
218         returns Boolean from Standard
219         ---C++: inline
220         
221         raises NotDone from StdFail
222         is static;
223
224
225     TangentAtLine(me; Index: out Integer from Standard)
226     
227         returns Dir from gp
228         ---C++: return const&
229         ---C++: inline
230
231         raises NotDone from StdFail
232         is static;
233
234
235 --private
236
237     TestDeflection(me : in out)
238
239         returns StatusDeflection from IntWalk
240         is static;
241         
242
243     TestArret(me : in out; DejaReparti : Boolean from Standard;
244                            Param : in out Array1OfReal from TColStd;
245                            ChoixIso : out ConstIsoparametric from IntImp)
246
247
248         returns Boolean from Standard
249         is static;
250         
251
252     RepartirOuDiviser(me : in out; DejaReparti : in out Boolean from Standard;
253                       ChoixIso : out  ConstIsoparametric from IntImp;
254                       Arrive : in out Boolean from Standard )
255                       
256         is static;
257
258     AddAPoint ( me    : in out  ; 
259                 line  : in  out  LineOn2S  from  IntSurf  ;     
260                 POn2S :          PntOn2S   from  IntSurf  ) ;
261         ---C++: inline
262                 
263     ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric  from IntImp;
264                                        theDirectionFlag: Boolean from Standard)
265         returns Boolean from Standard
266         is private;
267
268 fields
269
270     done               : Boolean  from Standard;
271     line               : LineOn2S from IntSurf;
272     close              : Boolean  from Standard;
273     tgfirst            : Boolean  from Standard;
274     tglast             : Boolean  from Standard;
275     indextg            : Integer  from Standard;
276     tgdir              : Dir      from gp;
277
278     fleche             : Real     from Standard;   -- fleche maxi autorisee
279     pasMax             : Real     from Standard;   -- ratio  uv maximum autorise
280     tolconf            : Real     from Standard;   -- tol de confusion de 2 points
281     pasuv              : Real     from Standard[4];-- pas uv sur les caros 
282     pasSav             : Real     from Standard[4];-- premier pas sauvegarde
283     pasInit            : Real     from Standard[4];-- sauvegarde des pas 
284
285     Um1                : Real from Standard;
286     UM1                : Real from Standard;
287     Vm1                : Real from Standard;
288     VM1                : Real from Standard;    
289     
290     Um2                : Real from Standard;
291     UM2                : Real from Standard;
292     Vm2                : Real from Standard;
293     VM2                : Real from Standard;  
294     
295     ResoU1             : Real from Standard;
296     ResoU2             : Real from Standard;
297     ResoV1             : Real from Standard;
298     ResoV2             : Real from Standard;
299
300     sensCheminement    : Integer  from Standard;
301     choixIsoSav        : ConstIsoparametric  from IntImp; 
302                        -- sauvegarde du choix 1 iere iso
303     previousPoint      : PntOn2S  from IntSurf;              
304                        -- point d 'intersection precedent
305     previoustg         : Boolean  from Standard;
306     previousd          : Dir      from gp;
307     previousd1         : Dir2d    from gp;
308     previousd2         : Dir2d    from gp;
309     firstd1            : Dir2d    from gp;
310     firstd2            : Dir2d    from gp;
311
312     myIntersectionOn2S : TheInt2S ;
313     STATIC_BLOCAGE_SUR_PAS_TROP_GRAND : Integer from Standard;
314     STATIC_PRECEDENT_INFLEXION        : Integer from Standard;
315 end PWalking;