1 -- Created on: 2001-04-05
2 -- Created by: Peter KURNEV
3 -- Copyright (c) 2001-2012 OPEN CASCADE SAS
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.
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.
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.
22 class Tools3D from BOPTools
25 -- The class contains handy static functions
26 -- dealing with the topology
42 ShapeEnum from TopAbs,
43 Orientation from TopAbs,
46 ListOfShape from TopTools,
47 Context from IntTools,
49 IndexedDataMapOfShapeListOfShape from TopTools
53 SubShapesAmount (myclass;
54 aS: Shape from TopoDS;
55 aT: ShapeEnum from TopAbs)
56 returns Integer from Standard ;
58 -- Returns amount of sub-shapes of type <aT>
61 IsConvexWire (myclass;
63 returns Boolean from Standard ;
66 -- amount of the vertices <= amount of the edges>
72 aContext: Context from IntTools);
74 -- Remove seam edges from face <aF>
77 aS: Shape from TopoDS;
78 aContext: Context from IntTools);
80 -- Remove seam edges from all faces of shape <aS>
82 EdgeOrientation (myclass;
83 aEx: Edge from TopoDS;
84 aF1: Face from TopoDS;
85 aF2: Face from TopoDS)
86 returns Orientation from TopAbs;
88 -- For the draft section edge <aEx> computes orientation
89 -- in accordance with vector product between normals to
90 -- the faces <aF1>, <aF2>
92 IsSplitToReverse1 (myclass;
93 aE1: Edge from TopoDS;
94 aE2: Edge from TopoDS;
95 aContext: Context from IntTools)
96 returns Boolean from Standard;
98 -- Returns TRUE if direction of the edge <aE1> is not
99 -- the same as for the edge <aE2>
100 -- (using projection)
102 DoSplitSEAMOnFace (myclass;
103 aSp: Edge from TopoDS;
104 aF : Face from TopoDS);
106 -- Make the edge <aSp> seam edge for the face <aF>
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;
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>
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;
130 -- Returns TRUE if the edge <aEx> is section edge
131 -- between touching faces <aF1>, <aF2>
133 GetTangentToEdge (myclass;
134 aE: Edge from TopoDS;
135 aT: Real from Standard;
137 returns Boolean from Standard;
139 -- Computes tangent (3D) for the edge <aE>
141 -- Returns TRUE if the edge <aE> is not degenerated.
143 GetTangentToEdge (myclass;
144 aE: Edge from TopoDS;
146 returns Boolean from Standard;
148 --- Computes tangent (3D) for the edge <aE>
149 --- at arbitrary intermediate parameter
150 --- Returns TRUE if the edge <aE> is not degenerated.
152 GetNormalToFaceOnEdge (myclass;
153 aE: Edge from TopoDS;
154 aF: Face from TopoDS;
155 aT: Real from Standard;
158 --- Computes normal to the face <aF> for the point on the edge <aE>
159 --- at parameter <aT>
161 GetNormalToFaceOnEdge (myclass;
162 aE: Edge from TopoDS;
163 aF: Face from TopoDS;
166 --- Computes normal to the face <aF> for the point on the edge <aE>
167 --- at arbitrary intermediate parameter
169 GetBiNormal (myclass;
170 aE: Edge from TopoDS;
171 aF: Face from TopoDS;
172 aT: Real from Standard;
175 --- Computes binormal to the face <aF> for the point on the edge <aE>
176 --- at parameter <aT>
178 GetBiNormal (myclass;
179 aE: Edge from TopoDS;
180 aF: Face from TopoDS;
183 --- Computes binormal to the face <aF> for the point on the edge <aE>
184 --- at arbitrary intermediate parameter
186 IsSplitToReverse(myclass;
187 aE : Edge from TopoDS;
188 aSp: Edge from TopoDS)
189 returns Boolean from Standard;
191 --- Returns TRUE if direction of the edge <aE1> is not
192 --- the same as for the edge <aE2>
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;
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
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;
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>
219 returns Integer from Standard;
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.
225 GetNormalToSurface (myclass;
226 aS: Surface from Geom;
227 U : Real from Standard;
228 V : Real from Standard;
230 returns Boolean from Standard;
232 --- Compute normal <aD> to surface <aS> in point (U,V)
233 --- Returns TRUE if directions aD1U, aD1V coinside
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;
242 aContext: Context from IntTools);
246 Orientation (myclass;
247 aE : Edge from TopoDS;
248 aF : Face from TopoDS)
249 returns Orientation from TopAbs;
251 --- Get the orientation for the edge <aE> on the face <aF>
252 --- Returns TopAbs_INTERNAL if the edge <aE> is not found
255 SignDistance (myclass;
258 returns Real from Standard;
260 --- Computes signed distance between the 3D-point <aP>
261 --- and the plane <aPL>.
264 --- The distance is not divided by sqrt(A*A+B*B+C*C)
266 GetApproxNormalToFaceOnEdge (myclass;
267 aE: Edge from TopoDS;
268 aF: Face from TopoDS;
269 aT: Real from Standard;
273 --- Computes normal to the face <aF> for the 3D-point that
274 --- belonds to the edge <aE> at parameter <aT>.
276 --- aPx - the 3D-point where the normal computed
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)
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);
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
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);
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()
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);
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()
320 PointToCompare (myclass;
323 aF: Face from TopoDS;
325 aContext: Context from IntTools);
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>
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;
338 aContext: Context from IntTools);
340 --- Compute 3D-state for the point on the split edge <aSp>
341 --- (with base edge <aE1> and the face <aF1>) comparing with
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);
351 --- Compute 3D-state for the point on the split edge <aSp>
352 --- (with base edge <aEF2> and the adjacent face <aF2Adj>) comparing with
356 OrientEdgeOnFace (myclass;
357 aE : Edge from TopoDS;
358 aF : Face from TopoDS;
359 aER : out Edge from TopoDS);
361 --- Get the edge <aER> from the face <aF> that is the same as
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;
372 --- Computes orientation for the split edge <aSp>
373 --- [with base edge <aEx> and face <aF2>] on the
377 aF : Face from TopoDS;
378 aSimm1 : out Edge from TopoDS;
379 aSimm2 : out Edge from TopoDS);
381 --- Get seam edges <aSimm1>, <aSimm2> for the face <aF>
384 aF : Face from TopoDS;
385 aS1: Edge from TopoDS;
386 aS2: out Edge from TopoDS);
388 --- Get opposite seam edge <aS2> for the face <aF> with
389 --- known seam edge <aS1>
391 IsValidArea (myclass;
392 aF : Face from TopoDS;
393 aNegativeFlag : out Boolean from Standard)
394 returns Boolean from Standard;
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
401 returns Real from Standard;
403 --- Returns simple step value that is used in 2D-computations
406 IsEmptyShape(myclass;
407 aS: Shape from TopoDS)
408 returns Boolean from Standard;
410 --- Returns TRUE if the shape <aS> does not contain
411 --- geometry information (e.g. empty compound)
414 aS : Shape from TopoDS;
415 aSInv:out Shape from TopoDS);
417 --- Change orientations to opposite for the shape <aS>
418 --- and all its sub-shapes. Returns <aSInv>
420 GetStatePartIN2D(myclass;
421 aSp :Edge from TopoDS;
422 aEF1 :Edge from TopoDS;
423 aF1 :Face from TopoDS;
424 aF2 :Face from TopoDS;
425 aContext: Context from IntTools)
426 returns State from TopAbs;
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>
434 CheckSameDomainFaceInside(myclass; theFace1: Face from TopoDS;
435 theFace2: Face from TopoDS;
436 theContext: Context from IntTools)
437 returns Boolean from Standard;
439 ComputeFaceState(myclass; theFace: Face from TopoDS;
440 theRef : Solid from TopoDS;
441 theContext: Context from IntTools;
442 theState: out State from TopAbs)
443 returns Boolean from Standard;
445 TreatedAsAnalytic(myclass; aTx :Real from Standard;
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;
454 aContext: Context from IntTools)
455 returns Boolean from Standard;
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;
463 aContext: Context from IntTools)
464 returns Boolean from Standard;
466 HasAnalyticSurfaceType (myclass; aF: Face from TopoDS)
467 returns Boolean from Standard;