b311480e |
1 | -- Created on: 2001-04-05 |
2 | -- Created by: Peter KURNEV |
3 | -- Copyright (c) 2001-2012 OPEN CASCADE SAS |
4 | -- |
5 | -- The content of this file is subject to the Open CASCADE Technology Public |
6 | -- License Version 6.5 (the "License"). You may not use the content of this file |
7 | -- except in compliance with the License. Please obtain a copy of the License |
8 | -- at http://www.opencascade.org and read it completely before using this file. |
9 | -- |
10 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
12 | -- |
13 | -- The Original Code and all software distributed under the License is |
14 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | -- Initial Developer hereby disclaims all such warranties, including without |
16 | -- limitation, any warranties of merchantability, fitness for a particular |
17 | -- purpose or non-infringement. Please see the License for the specific terms |
18 | -- and conditions governing the rights and limitations under the License. |
19 | |
7fd59977 |
20 | |
21 | |
22 | class Tools3D from BOPTools |
23 | |
24 | ---Purpose: |
25 | -- The class contains handy static functions |
26 | -- dealing with the topology |
27 | |
28 | uses |
29 | Pln from gp, |
30 | Dir from gp, |
31 | Pnt from gp, |
32 | Pnt2d from gp, |
33 | |
34 | Surface from Geom, |
35 | |
36 | Shape from TopoDS, |
37 | Wire from TopoDS, |
38 | Face from TopoDS, |
39 | Edge from TopoDS, |
40 | Solid from TopoDS, |
41 | |
42 | ShapeEnum from TopAbs, |
43 | Orientation from TopAbs, |
44 | State from TopAbs, |
45 | |
46 | ListOfShape from TopTools, |
47 | Context from IntTools, |
48 | |
49 | IndexedDataMapOfShapeListOfShape from TopTools |
50 | |
51 | is |
52 | |
53 | SubShapesAmount (myclass; |
54 | aS: Shape from TopoDS; |
55 | aT: ShapeEnum from TopAbs) |
56 | returns Integer from Standard ; |
57 | ---Purpose: |
58 | -- Returns amount of sub-shapes of type <aT> |
59 | -- for the shape <aS> |
60 | -- |
61 | IsConvexWire (myclass; |
62 | aW: Wire from TopoDS) |
63 | returns Boolean from Standard ; |
64 | ---Purpose: |
65 | -- Returns TRUE if |
66 | -- amount of the vertices <= amount of the edges> |
67 | -- for the wire <aW> |
68 | -- |
69 | |
70 | RemoveSims (myclass; |
71 | aF: Face from TopoDS; |
4f189102 |
72 | aContext: Context from IntTools); |
7fd59977 |
73 | ---Purpose: |
74 | -- Remove seam edges from face <aF> |
75 | -- |
76 | RemoveSims (myclass; |
77 | aS: Shape from TopoDS; |
4f189102 |
78 | aContext: Context from IntTools); |
7fd59977 |
79 | ---Purpose: |
80 | -- Remove seam edges from all faces of shape <aS> |
81 | -- |
82 | EdgeOrientation (myclass; |
83 | aEx: Edge from TopoDS; |
84 | aF1: Face from TopoDS; |
85 | aF2: Face from TopoDS) |
86 | returns Orientation from TopAbs; |
87 | ---Purpose: |
88 | -- For the draft section edge <aEx> computes orientation |
89 | -- in accordance with vector product between normals to |
90 | -- the faces <aF1>, <aF2> |
91 | -- |
92 | IsSplitToReverse1 (myclass; |
93 | aE1: Edge from TopoDS; |
94 | aE2: Edge from TopoDS; |
4f189102 |
95 | aContext: Context from IntTools) |
7fd59977 |
96 | returns Boolean from Standard; |
97 | ---Purpose: |
98 | -- Returns TRUE if direction of the edge <aE1> is not |
99 | -- the same as for the edge <aE2> |
100 | -- (using projection) |
101 | -- |
102 | DoSplitSEAMOnFace (myclass; |
103 | aSp: Edge from TopoDS; |
104 | aF : Face from TopoDS); |
105 | ---Purpose: |
106 | -- Make the edge <aSp> seam edge for the face <aF> |
107 | -- |
108 | |
109 | --modified by NIZHNY-MKK Mon Feb 17 15:02:01 2003.BEGIN |
110 | DoSplitSEAMOnFace (myclass; |
111 | theSplit : Edge from TopoDS; |
112 | theSeam : Edge from TopoDS; |
113 | theFace : Face from TopoDS; |
114 | IsReversed: out Boolean from Standard) |
115 | returns Boolean from Standard; |
116 | ---Purpose: |
117 | -- Make the edge <theSplit> seam edge for the face <theFace> |
118 | -- It uses pcurves of <theSeam> to make <theSplit> seam edge. |
119 | -- IsReversed is true if pcurves of <theSplit> and <theSeam> are |
120 | -- reversed according to each other. |
121 | -- Returns true if <theSplit> was made seam edge for <theFace> |
122 | -- |
123 | --modified by NIZHNY-MKK Mon Feb 17 15:02:04 2003.END |
124 | IsTouchCase (myclass; |
125 | aEx: Edge from TopoDS; |
126 | aF1: Face from TopoDS; |
127 | aF2: Face from TopoDS) |
128 | returns Boolean from Standard; |
129 | ---Purpose: |
130 | -- Returns TRUE if the edge <aEx> is section edge |
131 | -- between touching faces <aF1>, <aF2> |
132 | -- |
133 | GetTangentToEdge (myclass; |
134 | aE: Edge from TopoDS; |
135 | aT: Real from Standard; |
136 | aD:out Dir from gp) |
137 | returns Boolean from Standard; |
138 | ---Purpose: |
139 | -- Computes tangent (3D) for the edge <aE> |
140 | -- at parameter <aT> |
141 | -- Returns TRUE if the edge <aE> is not degenerated. |
142 | -- |
143 | GetTangentToEdge (myclass; |
144 | aE: Edge from TopoDS; |
145 | aD:out Dir from gp) |
146 | returns Boolean from Standard; |
147 | ---Purpose: |
148 | --- Computes tangent (3D) for the edge <aE> |
149 | --- at arbitrary intermediate parameter |
150 | --- Returns TRUE if the edge <aE> is not degenerated. |
151 | --- |
152 | GetNormalToFaceOnEdge (myclass; |
153 | aE: Edge from TopoDS; |
154 | aF: Face from TopoDS; |
155 | aT: Real from Standard; |
156 | aD:out Dir from gp); |
157 | ---Purpose: |
158 | --- Computes normal to the face <aF> for the point on the edge <aE> |
159 | --- at parameter <aT> |
160 | --- |
161 | GetNormalToFaceOnEdge (myclass; |
162 | aE: Edge from TopoDS; |
163 | aF: Face from TopoDS; |
164 | aD:out Dir from gp); |
165 | ---Purpose: |
166 | --- Computes normal to the face <aF> for the point on the edge <aE> |
167 | --- at arbitrary intermediate parameter |
168 | --- |
169 | GetBiNormal (myclass; |
170 | aE: Edge from TopoDS; |
171 | aF: Face from TopoDS; |
172 | aT: Real from Standard; |
173 | aD:out Dir from gp); |
174 | ---Purpose: |
175 | --- Computes binormal to the face <aF> for the point on the edge <aE> |
176 | --- at parameter <aT> |
177 | --- |
178 | GetBiNormal (myclass; |
179 | aE: Edge from TopoDS; |
180 | aF: Face from TopoDS; |
181 | aD:out Dir from gp); |
182 | ---Purpose: |
183 | --- Computes binormal to the face <aF> for the point on the edge <aE> |
184 | --- at arbitrary intermediate parameter |
185 | --- |
186 | IsSplitToReverse(myclass; |
187 | aE : Edge from TopoDS; |
188 | aSp: Edge from TopoDS) |
189 | returns Boolean from Standard; |
190 | ---Purpose: |
191 | --- Returns TRUE if direction of the edge <aE1> is not |
192 | --- the same as for the edge <aE2> |
193 | --- |
194 | GetAdjacentFace (myclass; |
195 | aF : Face from TopoDS; |
196 | aE : Edge from TopoDS; |
197 | aEFMap: IndexedDataMapOfShapeListOfShape from TopTools; |
198 | anAdjF:out Face from TopoDS) |
199 | returns Boolean from Standard; |
200 | ---Purpose: |
201 | --- Get face <anAdjF> that is adjacent to the face <aF> through |
202 | --- the edge <aE> (using map EF <aEFMap>) |
203 | --- Returns FALSE if adjacent face is not found |
204 | --- |
205 | IsKeepTwice (myclass; |
206 | aF1 : Face from TopoDS; |
207 | aF2 : Face from TopoDS; |
208 | aF2Adj: Face from TopoDS; |
209 | aSpEF2: Edge from TopoDS) |
210 | returns Boolean from Standard; |
211 | ---Purpose: |
212 | --- Returns TRUE if pair of faces <aF2> and <aF2Adj> |
213 | --- that are adjacent faces through the edge <aSpEF2> |
214 | --- crosses the face <aF1> by <aSpEF2> |
215 | --- |
216 | SenseFlag (myclass; |
217 | aNF1 : Dir from gp; |
218 | aNF2 : Dir from gp) |
219 | returns Integer from Standard; |
220 | ---Purpose: |
221 | --- Returns 1 if scalar product aNF1* aNF2>0. |
222 | --- Returns 0 if directions aNF1 aNF2 coinside |
223 | --- Returns -1 if scalar product aNF1* aNF2<0. |
224 | --- |
225 | GetNormalToSurface (myclass; |
226 | aS: Surface from Geom; |
227 | U : Real from Standard; |
228 | V : Real from Standard; |
229 | aD:out Dir from gp) |
230 | returns Boolean from Standard; |
231 | ---Purpose: |
232 | --- Compute normal <aD> to surface <aS> in point (U,V) |
233 | --- Returns TRUE if directions aD1U, aD1V coinside |
234 | --- |
235 | GetPlanes (myclass; |
236 | aSp : Edge from TopoDS; |
237 | aE2 : Edge from TopoDS; |
238 | aEFMap2: IndexedDataMapOfShapeListOfShape from TopTools; |
239 | aE1 : Edge from TopoDS; |
240 | aF1 : Face from TopoDS; |
241 | aST1:out State from TopAbs; |
4f189102 |
242 | aContext: Context from IntTools); |
7fd59977 |
243 | ---Purpose: |
244 | --- Internal usage |
245 | --- |
246 | Orientation (myclass; |
247 | aE : Edge from TopoDS; |
248 | aF : Face from TopoDS) |
249 | returns Orientation from TopAbs; |
250 | ---Purpose: |
251 | --- Get the orientation for the edge <aE> on the face <aF> |
252 | --- Returns TopAbs_INTERNAL if the edge <aE> is not found |
253 | --- on the face <aF> |
254 | --- |
255 | SignDistance (myclass; |
256 | aP : Pnt from gp; |
257 | aPL: Pln from gp) |
258 | returns Real from Standard; |
259 | ---Purpose: |
260 | --- Computes signed distance between the 3D-point <aP> |
261 | --- and the plane <aPL>. |
262 | --- |
263 | -- Warning: |
264 | --- The distance is not divided by sqrt(A*A+B*B+C*C) |
265 | --- |
266 | GetApproxNormalToFaceOnEdge (myclass; |
267 | aE: Edge from TopoDS; |
268 | aF: Face from TopoDS; |
269 | aT: Real from Standard; |
270 | aPx:out Pnt from gp; |
271 | aD:out Dir from gp); |
272 | ---Purpose: |
273 | --- Computes normal to the face <aF> for the 3D-point that |
274 | --- belonds to the edge <aE> at parameter <aT>. |
275 | -- Output: |
276 | --- aPx - the 3D-point where the normal computed |
277 | --- aD - the normal; |
278 | --- |
279 | -- Warning: |
280 | --- The normal is computed not exactly in the point on the |
281 | --- edge, but in point that is near to the edge towards to |
282 | --- the face material (so, we'll have approx. normal) |
283 | --- |
284 | PointNearEdge (myclass; |
285 | aE : Edge from TopoDS; |
286 | aF : Face from TopoDS; |
287 | aT : Real from Standard; |
288 | aDt2D: Real from Standard; |
289 | aP2D :out Pnt2d from gp; |
290 | aPx :out Pnt from gp); |
291 | ---Purpose: |
292 | --- Compute the point <aPx>, (<aP2D>) that is near to |
293 | --- the edge <aE> at parameter <aT> towards to the |
294 | --- material of the face <aF>. The value of shifting in |
295 | --- 2D is <aDt2D> |
296 | --- |
297 | PointNearEdge (myclass; |
298 | aE: Edge from TopoDS; |
299 | aF: Face from TopoDS; |
300 | aT: Real from Standard; |
301 | aP2D:out Pnt2d from gp; |
302 | aPx:out Pnt from gp); |
303 | ---Purpose: |
304 | --- Computes the point <aPx>, (<aP2D>) that is near to |
305 | --- the edge <aE> at parameter <aT> towards to the |
306 | --- material of the face <aF>. The value of shifting in |
307 | -- 2D is dt2D=BOPTools_Tools3D::MinStepIn2d() |
308 | --- |
309 | PointNearEdge (myclass; |
310 | aE: Edge from TopoDS; |
311 | aF: Face from TopoDS; |
312 | aP2D:out Pnt2d from gp; |
313 | aPx:out Pnt from gp); |
314 | ---Purpose: |
315 | --- Compute the point <aPx>, (<aP2D>) that is near to |
316 | --- the edge <aE> at arbitrary parameter towards to the |
317 | --- material of the face <aF>. The value of shifting in |
318 | -- 2D is dt2D=BOPTools_Tools3D::MinStepIn2d() |
319 | --- |
320 | PointToCompare (myclass; |
321 | aP1: Pnt from gp; |
322 | aP2: Pnt from gp; |
323 | aF: Face from TopoDS; |
324 | aPx:out Pnt from gp; |
4f189102 |
325 | aContext: Context from IntTools); |
7fd59977 |
326 | ---Purpose: |
327 | --- For 3D-point <aP1> find projection point <aPx> on the face <aF>. |
328 | --- If the distance (<aP1>, <aPx>) > TolF => |
329 | --- For 3D-point <aP2> find projection point <aPx> on the face <aF>. |
330 | --- If the distance (<aP2>, <aPx>) > TolF => returns <aP1> |
331 | --- |
332 | GetPlane (myclass; |
333 | aSp : Edge from TopoDS; |
334 | aE1 : Edge from TopoDS; |
335 | aF1 : Face from TopoDS; |
336 | aF2 : Face from TopoDS; |
337 | aST:out State from TopAbs; |
4f189102 |
338 | aContext: Context from IntTools); |
7fd59977 |
339 | ---Purpose: |
340 | --- Compute 3D-state for the point on the split edge <aSp> |
341 | --- (with base edge <aE1> and the face <aF1>) comparing with |
342 | --- the face <aF2> |
343 | --- |
344 | GetPointState (myclass; |
345 | aSp : Edge from TopoDS; |
346 | aEF2 : Edge from TopoDS; |
347 | aF2Adj : Face from TopoDS; |
348 | aF1 : Face from TopoDS; |
349 | aST:out State from TopAbs); |
350 | ---Purpose: |
351 | --- Compute 3D-state for the point on the split edge <aSp> |
352 | --- (with base edge <aEF2> and the adjacent face <aF2Adj>) comparing with |
353 | --- the face <aF1> |
354 | --- |
355 | |
356 | OrientEdgeOnFace (myclass; |
357 | aE : Edge from TopoDS; |
358 | aF : Face from TopoDS; |
359 | aER : out Edge from TopoDS); |
360 | ---Purpose: |
361 | --- Get the edge <aER> from the face <aF> that is the same as |
362 | --- the edge <aE> |
363 | --- |
364 | |
365 | OrientTouchEdgeOnF1 (myclass; |
366 | aSp: Edge from TopoDS; |
367 | aEx: Edge from TopoDS; |
368 | aF1: Face from TopoDS; |
369 | aF2: Face from TopoDS) |
370 | returns Orientation from TopAbs; |
371 | ---Purpose: |
372 | --- Computes orientation for the split edge <aSp> |
373 | --- [with base edge <aEx> and face <aF2>] on the |
374 | --- face <aF1> |
375 | --- |
376 | GetSeams (myclass; |
377 | aF : Face from TopoDS; |
378 | aSimm1 : out Edge from TopoDS; |
379 | aSimm2 : out Edge from TopoDS); |
380 | ---Purpose: |
381 | --- Get seam edges <aSimm1>, <aSimm2> for the face <aF> |
382 | --- |
383 | GetSeam (myclass; |
384 | aF : Face from TopoDS; |
385 | aS1: Edge from TopoDS; |
386 | aS2: out Edge from TopoDS); |
387 | ---Purpose: |
388 | --- Get opposite seam edge <aS2> for the face <aF> with |
389 | --- known seam edge <aS1> |
390 | --- |
391 | IsValidArea (myclass; |
392 | aF : Face from TopoDS; |
393 | aNegativeFlag : out Boolean from Standard) |
394 | returns Boolean from Standard; |
395 | ---Purpose: |
396 | --- Check validity of the area of face <aF>. |
397 | --- Returns TRUE if the Abs. value of the area |
398 | --- is greater than 1.e-16 |
399 | --- |
400 | MinStepIn2d(myclass) |
401 | returns Real from Standard; |
402 | ---Purpose: |
403 | --- Returns simple step value that is used in 2D-computations |
404 | --- = 1.e-5 |
405 | --- |
406 | IsEmptyShape(myclass; |
407 | aS: Shape from TopoDS) |
408 | returns Boolean from Standard; |
409 | ---Purpose: |
410 | --- Returns TRUE if the shape <aS> does not contain |
411 | --- geometry information (e.g. empty compound) |
412 | --- |
413 | InvertShape(myclass; |
414 | aS : Shape from TopoDS; |
415 | aSInv:out Shape from TopoDS); |
416 | ---Purpose: |
417 | --- Change orientations to opposite for the shape <aS> |
418 | --- and all its sub-shapes. Returns <aSInv> |
419 | --- |
420 | GetStatePartIN2D(myclass; |
421 | aSp :Edge from TopoDS; |
422 | aEF1 :Edge from TopoDS; |
423 | aF1 :Face from TopoDS; |
424 | aF2 :Face from TopoDS; |
4f189102 |
425 | aContext: Context from IntTools) |
7fd59977 |
426 | returns State from TopAbs; |
427 | ---Purpose: |
428 | --- Used in touch case |
429 | --- Compute the 3D-state for the point on the split |
430 | --- edge <aSp> (with base edge <aEF1> on face <aF1>) |
431 | --- comparing with <aF2>. |
432 | --- Used in touch case <aF1>/<aF2> |
433 | --- |
434 | CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS; |
435 | theFace2: Face from TopoDS; |
4f189102 |
436 | theContext: Context from IntTools) |
7fd59977 |
437 | returns Boolean from Standard; |
438 | |
439 | ComputeFaceState(myclass; theFace: Face from TopoDS; |
440 | theRef : Solid from TopoDS; |
4f189102 |
441 | theContext: Context from IntTools; |
7fd59977 |
442 | theState: out State from TopAbs) |
443 | returns Boolean from Standard; |
444 | |
445 | TreatedAsAnalytic(myclass; aTx :Real from Standard; |
446 | aPx :Pnt from gp; |
447 | aEx :Edge from TopoDS; |
448 | aFx :Face from TopoDS; |
449 | aE1 :Edge from TopoDS; |
450 | aF1 :Face from TopoDS; |
451 | aTolTangent:Real from Standard; |
452 | aTolRadius :Real from Standard; |
453 | aState :out State from TopAbs; |
4f189102 |
454 | aContext: Context from IntTools) |
7fd59977 |
455 | returns Boolean from Standard; |
456 | |
457 | TreatedAsAnalytic (myclass; aFx :Face from TopoDS; |
458 | aSpE1 :Edge from TopoDS; |
459 | aF1 :Face from TopoDS; |
460 | aTolTangent:Real from Standard; |
461 | aTolRadius :Real from Standard; |
462 | aState :out State from TopAbs; |
4f189102 |
463 | aContext: Context from IntTools) |
7fd59977 |
464 | returns Boolean from Standard; |
465 | |
466 | HasAnalyticSurfaceType (myclass; aF: Face from TopoDS) |
467 | returns Boolean from Standard; |
468 | |
469 | end Tools3D; |
470 | |
471 | |
472 | |