Commit | Line | Data |
---|---|---|
b311480e | 1 | -- Created on: 1992-04-03 |
2 | -- Created by: Isabelle GRIGNON | |
3 | -- Copyright (c) 1992-1999 Matra Datavision | |
973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e | 5 | -- |
973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |
b311480e | 7 | -- |
d5f74e42 | 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 | |
973c2be1 | 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. | |
b311480e | 13 | -- |
973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. | |
7fd59977 | 16 | |
47cbf134 | 17 | class PWalking from IntWalk |
7fd59977 | 18 | |
19 | ---Purpose: This class implements an algorithm to determine the | |
b1c5c4e6 | 20 | -- intersection between 2 parametrized surfaces, marching from |
7fd59977 | 21 | -- a starting point. The intersection line |
b1c5c4e6 | 22 | -- starts and ends on the natural surface's boundaries . |
7fd59977 | 23 | |
24 | ||
25 | uses XY from gp, | |
26 | StatusDeflection from IntWalk, | |
27 | ConstIsoparametric from IntImp, | |
28 | Array1OfReal from TColStd, | |
29 | PntOn2S from IntSurf, | |
30 | LineOn2S from IntSurf, | |
31 | Dir from gp, | |
00302ba4 | 32 | Dir2d from gp, |
47cbf134 | 33 | Pnt from gp, |
34 | TheInt2S from IntWalk, | |
35 | HSurface from Adaptor3d, | |
36 | HSurfaceTool from Adaptor3d | |
7fd59977 | 37 | |
38 | ||
39 | raises OutOfRange from Standard, | |
40 | NotDone from StdFail | |
41 | ||
42 | ||
7fd59977 | 43 | is |
44 | ||
45 | ||
46 | Create ( Caro1 , | |
47cbf134 | 47 | Caro2 : HSurface from Adaptor3d ; |
7fd59977 | 48 | TolTangency, |
49 | Epsilon, | |
50 | Deflection, | |
51 | Increment : Real from Standard) | |
52 | ||
53 | ---Purpose: Constructor used to set the data to compute intersection | |
54 | -- lines between Caro1 and Caro2. | |
55 | -- Deflection is the maximum deflection admitted between two | |
56 | -- consecutive points on the resulting polyline. | |
57 | -- TolTangency is the tolerance to find a tangent point. | |
58 | -- Func is the criterion which has to be evaluated at each | |
59 | -- solution point (each point of the line). | |
60 | -- It is necessary to call the Perform method to compute | |
61 | -- the intersection lines. | |
b1c5c4e6 | 62 | -- The line found starts at a point on or in 2 natural domains |
63 | -- of surfaces. It can be closed in the | |
64 | -- standard case if it is open it stops and begins at the | |
65 | -- border of one of the domains. If an open line | |
66 | -- stops at the middle of a domain, one stops at the tangent point. | |
67 | -- Epsilon is SquareTolerance of points confusion. | |
7fd59977 | 68 | |
69 | returns PWalking; | |
70 | ||
71 | ||
72 | Create ( Caro1 , | |
47cbf134 | 73 | Caro2 : HSurface from Adaptor3d ; |
7fd59977 | 74 | TolTangency, |
75 | Epsilon, | |
76 | Deflection, | |
77 | Increment : Real from Standard; | |
78 | U1,V1,U2,V2 :Real from Standard) | |
79 | ||
80 | ---Purpose: Returns the intersection line containing the exact | |
81 | -- point Poin. This line is a polygonal line. | |
82 | -- Deflection is the maximum deflection admitted between two | |
83 | -- consecutive points on the resulting polyline. | |
84 | -- TolTangency is the tolerance to find a tangent point. | |
85 | -- Func is the criterion which has to be evaluated at each | |
86 | -- solution point (each point of the line). | |
b1c5c4e6 | 87 | -- The line found starts at a point on or in 2 natural domains |
88 | -- of surfaces. It can be closed in the | |
89 | -- standard case if it is open it stops and begins at the | |
90 | -- border of one of the domains. If an open line | |
91 | -- stops at the middle of a domain, one stops at the tangent point. | |
92 | -- Epsilon is SquareTolerance of points confusion. | |
7fd59977 | 93 | |
94 | returns PWalking; | |
95 | ||
96 | ||
97 | Perform(me :in out;ParDep : Array1OfReal from TColStd) | |
98 | ||
b1c5c4e6 | 99 | ---Purpose: calculate the line of intersection |
7fd59977 | 100 | |
101 | is static; | |
102 | ||
103 | Perform(me :in out;ParDep : Array1OfReal from TColStd; | |
104 | u1min,v1min,u2min,v2min,u1max,v1max,u2max,v2max: Real from Standard) | |
105 | ||
b1c5c4e6 | 106 | ---Purpose: calculate the line of intersection. The regulation |
107 | -- of steps is done using min and max values on u and | |
108 | -- v. (if this data is not presented as in the | |
109 | -- previous method, the initial steps are calculated | |
110 | -- starting from min and max uv of faces). | |
7fd59977 | 111 | |
112 | is static; | |
113 | ||
114 | ||
115 | PerformFirstPoint(me :in out; | |
116 | ParDep : Array1OfReal from TColStd; | |
117 | FirstPoint: in out PntOn2S from IntSurf) | |
118 | ||
b1c5c4e6 | 119 | ---Purpose: calculate the first point of a line of intersection |
7fd59977 | 120 | -- |
121 | ||
122 | returns Boolean from Standard | |
123 | ||
124 | is static; | |
125 | ||
126 | ||
127 | IsDone(me) | |
128 | ||
129 | ---Purpose: Returns true if the calculus was successful. | |
130 | ||
131 | returns Boolean from Standard | |
132 | ---C++: inline | |
133 | ||
134 | is static; | |
135 | ||
136 | ||
137 | NbPoints(me) | |
138 | ||
139 | ---Purpose: Returns the number of points of the resulting polyline. | |
140 | -- An exception is raised if IsDone returns False. | |
141 | ||
142 | returns Integer from Standard | |
143 | ---C++: inline | |
144 | ||
145 | raises NotDone from StdFail | |
146 | ||
147 | is static; | |
148 | ||
149 | ||
150 | Value(me ; Index : Integer from Standard) | |
151 | ||
152 | ---Purpose: Returns the point of range Index on the polyline. | |
153 | -- An exception is raised if IsDone returns False. | |
154 | -- An exception is raised if Index<=0 or Index>NbPoints. | |
155 | ||
156 | returns PntOn2S from IntSurf | |
157 | ---C++: inline | |
158 | ---C++: return const& | |
159 | ||
160 | raises NotDone from StdFail, | |
161 | OutOfRange from Standard | |
162 | ||
163 | is static; | |
164 | ||
165 | ||
166 | Line(me) | |
167 | ||
6e33d3ce | 168 | returns LineOn2S from IntSurf |
7fd59977 | 169 | ---C++: inline |
170 | ---C++: return const& | |
171 | ||
172 | raises NotDone from StdFail | |
173 | is static; | |
174 | ||
175 | ||
176 | TangentAtFirst(me) | |
177 | ||
178 | ---Purpose: Returns True if the surface are tangent at the first point | |
179 | -- of the line. | |
180 | -- An exception is raised if IsDone returns False. | |
181 | ||
182 | returns Boolean from Standard | |
183 | ---C++: inline | |
184 | ||
185 | raises NotDone from StdFail | |
186 | ||
187 | is static; | |
188 | ||
189 | ||
190 | TangentAtLast(me) | |
191 | ||
192 | ---Purpose: Returns true if the surface are tangent at the last point | |
193 | -- of the line. | |
194 | -- An exception is raised if IsDone returns False. | |
195 | ||
196 | returns Boolean from Standard | |
197 | ---C++: inline | |
198 | ||
199 | raises NotDone from StdFail | |
200 | is static; | |
201 | ||
202 | ||
203 | IsClosed(me) | |
204 | ||
205 | ---Purpose: Returns True if the line is closed. | |
206 | -- An exception is raised if IsDone returns False. | |
207 | ||
208 | returns Boolean from Standard | |
209 | ---C++: inline | |
210 | ||
211 | raises NotDone from StdFail | |
212 | is static; | |
213 | ||
214 | ||
215 | TangentAtLine(me; Index: out Integer from Standard) | |
216 | ||
217 | returns Dir from gp | |
218 | ---C++: return const& | |
219 | ---C++: inline | |
220 | ||
221 | raises NotDone from StdFail | |
222 | is static; | |
223 | ||
224 | ||
225 | --private | |
226 | ||
227 | TestDeflection(me : in out) | |
228 | ||
229 | returns StatusDeflection from IntWalk | |
230 | is static; | |
231 | ||
232 | ||
233 | TestArret(me : in out; DejaReparti : Boolean from Standard; | |
234 | Param : in out Array1OfReal from TColStd; | |
235 | ChoixIso : out ConstIsoparametric from IntImp) | |
236 | ||
237 | ||
238 | returns Boolean from Standard | |
239 | is static; | |
240 | ||
241 | ||
242 | RepartirOuDiviser(me : in out; DejaReparti : in out Boolean from Standard; | |
243 | ChoixIso : out ConstIsoparametric from IntImp; | |
244 | Arrive : in out Boolean from Standard ) | |
245 | ||
246 | is static; | |
247 | ||
248 | AddAPoint ( me : in out ; | |
00302ba4 | 249 | line : in out LineOn2S from IntSurf ; |
250 | POn2S : PntOn2S from IntSurf ) ; | |
251 | ---C++: inline | |
252 | ||
7fd59977 | 253 | ExtendLineInCommonZone(me: in out; theChoixIso: ConstIsoparametric from IntImp; |
00302ba4 | 254 | theDirectionFlag: Boolean from Standard) |
255 | returns Boolean from Standard | |
256 | is private; | |
257 | ||
258 | DistanceMinimizeByGradient( me : in out; | |
47cbf134 | 259 | theASurf1 , theASurf2 : HSurface from Adaptor3d ; |
00302ba4 | 260 | theU1, theV1, theU2, theV2: out Real from Standard; |
261 | theStep0U1V1: Real from Standard = 1.0e-6; | |
262 | theStep0U2V2: Real from Standard = 1.0e-6) | |
263 | returns Boolean from Standard | |
264 | is private; | |
c2c2f2b6 | 265 | -- Finds one intersection point of two given surfaces with given |
266 | -- initial point. | |
00302ba4 | 267 | |
268 | DistanceMinimizeByExtrema(me : in out; | |
47cbf134 | 269 | theASurf1 : HSurface from Adaptor3d ; |
00302ba4 | 270 | theP0 : Pnt from gp; |
271 | theU0, theV0: out Real from Standard; | |
272 | theStep0U: Real from Standard = 1.0; | |
273 | theStep0V: Real from Standard = 1.0) | |
274 | returns Boolean from Standard | |
275 | is private; | |
c2c2f2b6 | 276 | -- Finds one intersection point of two given surfaces with given |
277 | -- initial point. | |
00302ba4 | 278 | |
c2c2f2b6 | 279 | SeekPointOnBoundary(me : in out; |
47cbf134 | 280 | theASurf1 , theASurf2 : HSurface from Adaptor3d ; |
c2c2f2b6 | 281 | theU1, theV1, theU2, theV2: Real from Standard; |
282 | isTheFirst : Boolean from Standard) | |
283 | returns Boolean from Standard | |
284 | is private; | |
285 | -- Unites and correctly coordinates of work of | |
286 | -- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions. | |
287 | ||
288 | ||
289 | PutToBoundary( me : in out; | |
47cbf134 | 290 | theASurf1 , theASurf2 : HSurface from Adaptor3d) |
c2c2f2b6 | 291 | -- Tries to extend existing intersection line |
292 | -- (as set of points) to surface's boundaries, | |
293 | -- if it is possibly. | |
294 | -- If line is scienter far from boundaries | |
295 | -- or is (almost) parralel with some boundary, | |
296 | -- extending is not required. | |
297 | returns Boolean from Standard; | |
298 | ||
299 | ||
00302ba4 | 300 | SeekAdditionalPoints( me : in out; |
47cbf134 | 301 | theASurf1 , theASurf2 : HSurface from Adaptor3d; |
00302ba4 | 302 | theMinNbPoints : Integer from Standard) |
303 | returns Boolean from Standard; | |
c2c2f2b6 | 304 | -- Unites and correctly coordinates of work of |
305 | -- "DistanceMinimizeByGradient" and "DistanceMinimizeByExtrema" functions. | |
7fd59977 | 306 | |
307 | fields | |
308 | ||
309 | done : Boolean from Standard; | |
310 | line : LineOn2S from IntSurf; | |
311 | close : Boolean from Standard; | |
312 | tgfirst : Boolean from Standard; | |
313 | tglast : Boolean from Standard; | |
314 | indextg : Integer from Standard; | |
315 | tgdir : Dir from gp; | |
316 | ||
b1c5c4e6 | 317 | fleche : Real from Standard; -- max possible vector |
318 | pasMax : Real from Standard; -- max possible uv ratio | |
319 | tolconf : Real from Standard; -- tol of confusion of 2 points | |
320 | pasuv : Real from Standard[4];-- uv step on squares | |
321 | pasSav : Real from Standard[4];-- first saved step | |
322 | pasInit : Real from Standard[4];-- saving of steps | |
7fd59977 | 323 | |
324 | Um1 : Real from Standard; | |
325 | UM1 : Real from Standard; | |
326 | Vm1 : Real from Standard; | |
327 | VM1 : Real from Standard; | |
328 | ||
329 | Um2 : Real from Standard; | |
330 | UM2 : Real from Standard; | |
331 | Vm2 : Real from Standard; | |
332 | VM2 : Real from Standard; | |
333 | ||
334 | ResoU1 : Real from Standard; | |
335 | ResoU2 : Real from Standard; | |
336 | ResoV1 : Real from Standard; | |
337 | ResoV2 : Real from Standard; | |
338 | ||
339 | sensCheminement : Integer from Standard; | |
340 | choixIsoSav : ConstIsoparametric from IntImp; | |
b1c5c4e6 | 341 | -- save 1st iso choice |
7fd59977 | 342 | previousPoint : PntOn2S from IntSurf; |
b1c5c4e6 | 343 | -- previous intersection point |
7fd59977 | 344 | previoustg : Boolean from Standard; |
345 | previousd : Dir from gp; | |
346 | previousd1 : Dir2d from gp; | |
347 | previousd2 : Dir2d from gp; | |
348 | firstd1 : Dir2d from gp; | |
349 | firstd2 : Dir2d from gp; | |
350 | ||
47cbf134 | 351 | myIntersectionOn2S : TheInt2S from IntWalk; |
1ef32e96 RL |
352 | STATIC_BLOCAGE_SUR_PAS_TROP_GRAND : Integer from Standard; |
353 | STATIC_PRECEDENT_INFLEXION : Integer from Standard; | |
7fd59977 | 354 | end PWalking; |