42cf5bc1 |
1 | // Created by: Peter KURNEV |
2 | // Copyright (c) 2010-2014 OPEN CASCADE SAS |
3 | // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE |
4 | // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, |
5 | // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
6 | // |
7 | // This file is part of Open CASCADE Technology software library. |
8 | // |
9 | // This library is free software; you can redistribute it and/or modify it under |
10 | // the terms of the GNU Lesser General Public License version 2.1 as published |
11 | // by the Free Software Foundation, with special exception defined in the file |
12 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
13 | // distribution for complete text of the license and disclaimer of any warranty. |
14 | // |
15 | // Alternatively, this file may be used under the terms of Open CASCADE |
16 | // commercial license or contractual agreement. |
17 | |
18 | #ifndef _BOPTools_AlgoTools_HeaderFile |
19 | #define _BOPTools_AlgoTools_HeaderFile |
20 | |
21 | #include <Standard.hxx> |
22 | #include <Standard_DefineAlloc.hxx> |
23 | #include <Standard_Handle.hxx> |
24 | |
1155d05a |
25 | #include <Standard_Boolean.hxx> |
42cf5bc1 |
26 | #include <Standard_Integer.hxx> |
27 | #include <Standard_Real.hxx> |
42cf5bc1 |
28 | #include <BOPTools_ListOfCoupleOfShape.hxx> |
98b37659 |
29 | #include <BOPTools_ListOfConnexityBlock.hxx> |
1155d05a |
30 | #include <NCollection_BaseAllocator.hxx> |
42cf5bc1 |
31 | #include <TopAbs_State.hxx> |
1155d05a |
32 | #include <TopAbs_ShapeEnum.hxx> |
33 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
34 | #include <TopTools_IndexedMapOfShape.hxx> |
35 | #include <TopTools_ListOfListOfShape.hxx> |
36 | #include <TopTools_ListOfShape.hxx> |
0d0481c7 |
37 | #include <Precision.hxx> |
42cf5bc1 |
38 | class TopoDS_Vertex; |
39 | class gp_Pnt; |
40 | class IntTools_Curve; |
41 | class TopoDS_Edge; |
42 | class TopoDS_Face; |
43 | class TopoDS_Shape; |
44 | class IntTools_Context; |
45 | class TopoDS_Solid; |
46 | class IntTools_Range; |
47 | class TopoDS_Shell; |
80d55adf |
48 | class Message_Report; |
49 | |
50 | //! Provides tools used in Boolean Operations algorithm: |
51 | //! - Vertices intersection; |
52 | //! - Vertex construction; |
53 | //! - Edge construction; |
54 | //! - Classification algorithms; |
55 | //! - Making connexity blocks; |
56 | //! - Shape validation. |
57 | class BOPTools_AlgoTools |
42cf5bc1 |
58 | { |
59 | public: |
60 | |
61 | DEFINE_STANDARD_ALLOC |
62 | |
80d55adf |
63 | public: //! @name Intersection of the vertices |
64 | |
65 | //! Intersects the vertex <theV1> with the point <theP> with tolerance <theTolP>. |
66 | //! Returns the error status: |
67 | //! - 0 - no error, meaning that the vertex intersects the point; |
68 | //! - 1 - the distance between vertex and point is grater than the sum of tolerances. |
69 | Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& theV, |
70 | const gp_Pnt& theP, |
71 | const Standard_Real theTolP); |
72 | |
73 | //! Intersects the given vertices with given fuzzy value. |
74 | //! Returns the error status: |
75 | //! - 0 - no error, meaning that the vertices interferes with given tolerance; |
76 | //! - 1 - the distance between vertices is grater than the sum of their tolerances. |
77 | Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& theV1, |
78 | const TopoDS_Vertex& theV2, |
79 | const Standard_Real theFuzz = Precision::Confusion()); |
80 | |
81 | public: //! @name Vertices construction |
82 | |
83 | //! Makes the vertex in the middle of given vertices with |
84 | //! the tolerance covering all tolerance spheres of vertices. |
85 | Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV, |
86 | TopoDS_Vertex& theV); |
87 | |
88 | //! Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol> |
89 | Standard_EXPORT static void MakeNewVertex(const gp_Pnt& aP1, |
90 | const Standard_Real aTol, |
91 | TopoDS_Vertex& aNewVertex); |
92 | |
93 | //! Make a vertex using couple of vertices <aV1, aV2> |
94 | Standard_EXPORT static void MakeNewVertex(const TopoDS_Vertex& aV1, |
95 | const TopoDS_Vertex& aV2, |
96 | TopoDS_Vertex& aNewVertex); |
97 | |
98 | //! Make a vertex in place of intersection between two edges |
99 | //! <aE1, aE2> with parameters <aP1, aP2> |
100 | Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, |
101 | const Standard_Real aP1, |
102 | const TopoDS_Edge& aE2, |
103 | const Standard_Real aP2, |
104 | TopoDS_Vertex& aNewVertex); |
105 | |
106 | //! Make a vertex in place of intersection between the edge <aE1> |
107 | //! with parameter <aP1> and the face <aF2> |
108 | Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1, |
109 | const Standard_Real aP1, |
110 | const TopoDS_Face& aF2, |
111 | TopoDS_Vertex& aNewVertex); |
112 | |
113 | |
114 | public: //! @name Updating the vertex |
115 | |
116 | //! Update the tolerance value for vertex <aV> |
117 | //! taking into account the fact that <aV> lays on |
118 | //! the curve <aIC> |
119 | Standard_EXPORT static void UpdateVertex(const IntTools_Curve& aIC, |
120 | const Standard_Real aT, |
121 | const TopoDS_Vertex& aV); |
122 | |
123 | //! Update the tolerance value for vertex <aV> |
124 | //! taking into account the fact that <aV> lays on |
125 | //! the edge <aE> |
126 | Standard_EXPORT static void UpdateVertex(const TopoDS_Edge& aE, |
127 | const Standard_Real aT, |
128 | const TopoDS_Vertex& aV); |
129 | |
130 | //! Update the tolerance value for vertex <aVN> |
131 | //! taking into account the fact that <aVN> should |
132 | //! cover tolerance zone of <aVF> |
133 | Standard_EXPORT static void UpdateVertex(const TopoDS_Vertex& aVF, |
134 | const TopoDS_Vertex& aVN); |
135 | |
136 | |
137 | public: //! @name Edge construction |
138 | |
139 | //! Makes the edge based on the given curve with given bounding vertices. |
140 | Standard_EXPORT static void MakeEdge(const IntTools_Curve& theCurve, |
141 | const TopoDS_Vertex& theV1, |
142 | const Standard_Real theT1, |
143 | const TopoDS_Vertex& theV2, |
144 | const Standard_Real theT2, |
145 | const Standard_Real theTolR3D, |
146 | TopoDS_Edge& theE); |
147 | |
148 | //! Makes a copy of <theEdge> with vertices. |
149 | Standard_EXPORT static TopoDS_Edge CopyEdge(const TopoDS_Edge& theEdge); |
150 | |
151 | //! Make the edge from base edge <aE1> and two vertices <aV1,aV2> |
152 | //! at parameters <aP1,aP2> |
153 | Standard_EXPORT static void MakeSplitEdge(const TopoDS_Edge& aE1, |
154 | const TopoDS_Vertex& aV1, |
155 | const Standard_Real aP1, |
156 | const TopoDS_Vertex& aV2, |
157 | const Standard_Real aP2, |
158 | TopoDS_Edge& aNewEdge); |
159 | |
160 | //! Make the edge from 3D-Curve <aIC> and two vertices <aV1,aV2> |
161 | //! at parameters <aP1,aP2> |
162 | Standard_EXPORT static void MakeSectEdge(const IntTools_Curve& aIC, |
163 | const TopoDS_Vertex& aV1, |
164 | const Standard_Real aP1, |
165 | const TopoDS_Vertex& aV2, |
166 | const Standard_Real aP2, |
167 | TopoDS_Edge& aNewEdge); |
168 | |
169 | |
170 | public: //! @name Point/Edge/Face classification relatively solid |
171 | |
42cf5bc1 |
172 | //! Computes the 3-D state of the point thePoint |
173 | //! toward solid theSolid. |
174 | //! theTol - value of precision of computation |
175 | //! theContext- cahed geometrical tools |
176 | //! Returns 3-D state. |
80d55adf |
177 | Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint, |
178 | const TopoDS_Solid& theSolid, |
179 | const Standard_Real theTol, |
180 | const Handle(IntTools_Context)& theContext); |
42cf5bc1 |
181 | |
182 | //! Computes the 3-D state of the vertex theVertex |
183 | //! toward solid theSolid. |
184 | //! theTol - value of precision of computation |
185 | //! theContext- cahed geometrical tools |
186 | //! Returns 3-D state. |
80d55adf |
187 | Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex, |
188 | const TopoDS_Solid& theSolid, |
189 | const Standard_Real theTol, |
190 | const Handle(IntTools_Context)& theContext); |
42cf5bc1 |
191 | |
192 | //! Computes the 3-D state of the edge theEdge |
193 | //! toward solid theSolid. |
194 | //! theTol - value of precision of computation |
195 | //! theContext- cahed geometrical tools |
196 | //! Returns 3-D state. |
80d55adf |
197 | Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge, |
198 | const TopoDS_Solid& theSolid, |
199 | const Standard_Real theTol, |
200 | const Handle(IntTools_Context)& theContext); |
42cf5bc1 |
201 | |
202 | //! Computes the 3-D state of the face theFace |
203 | //! toward solid theSolid. |
204 | //! theTol - value of precision of computation |
56062e13 |
205 | //! theBounds - set of edges of <theSolid> to avoid |
42cf5bc1 |
206 | //! theContext- cahed geometrical tools |
207 | //! Returns 3-D state. |
80d55adf |
208 | Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace, |
209 | const TopoDS_Solid& theSolid, |
210 | const Standard_Real theTol, |
56062e13 |
211 | const TopTools_IndexedMapOfShape& theBounds, |
80d55adf |
212 | const Handle(IntTools_Context)& theContext); |
42cf5bc1 |
213 | |
214 | //! Computes the 3-D state of the shape theShape |
215 | //! toward solid theSolid. |
216 | //! theTol - value of precision of computation |
217 | //! theContext- cahed geometrical tools |
218 | //! Returns 3-D state. |
80d55adf |
219 | Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape, |
220 | const TopoDS_Solid& theSolid, |
221 | const Standard_Real theTol, |
222 | const Handle(IntTools_Context)& theContext); |
223 | |
224 | |
225 | public: //! @name Face classification relatively solid |
226 | |
227 | //! For the face theFace and its edge theEdge |
228 | //! finds the face suitable to produce shell. |
229 | //! theLCEF - set of faces to search. All faces |
230 | //! from theLCEF must share edge theEdge |
231 | Standard_EXPORT static Standard_Boolean GetFaceOff(const TopoDS_Edge& theEdge, |
232 | const TopoDS_Face& theFace, |
233 | BOPTools_ListOfCoupleOfShape& theLCEF, |
234 | TopoDS_Face& theFaceOff, |
235 | const Handle(IntTools_Context)& theContext); |
236 | |
237 | //! Returns True if the face theFace is inside of the |
238 | //! couple of faces theFace1, theFace2. |
239 | //! The faces theFace, theFace1, theFace2 must |
240 | //! share the edge theEdge |
241 | //! Return values: |
242 | //! * 0 state is not IN |
243 | //! * 1 state is IN |
244 | //! * 2 state can not be found by the method of angles |
245 | Standard_EXPORT static Standard_Integer IsInternalFace(const TopoDS_Face& theFace, |
246 | const TopoDS_Edge& theEdge, |
247 | const TopoDS_Face& theFace1, |
248 | const TopoDS_Face& theFace2, |
249 | const Handle(IntTools_Context)& theContext); |
250 | |
251 | //! Returns True if the face theFace is inside of the |
252 | //! appropriate couple of faces (from the set theLF) . |
253 | //! The faces of the set theLF and theFace must |
254 | //! share the edge theEdge |
255 | //! * 0 state is not IN |
256 | //! * 1 state is IN |
257 | //! * 2 state can not be found by the method of angles |
258 | Standard_EXPORT static Standard_Integer IsInternalFace(const TopoDS_Face& theFace, |
259 | const TopoDS_Edge& theEdge, |
260 | TopTools_ListOfShape& theLF, |
261 | const Handle(IntTools_Context)& theContext); |
262 | |
263 | //! Returns True if the face theFace is inside the |
264 | //! solid theSolid. |
265 | //! theMEF - Map Edge/Faces for theSolid |
266 | //! theTol - value of precision of computation |
267 | //! theContext- cahed geometrical tools |
268 | Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace, |
269 | const TopoDS_Solid& theSolid, |
270 | TopTools_IndexedDataMapOfShapeListOfShape& theMEF, |
271 | const Standard_Real theTol, |
272 | const Handle(IntTools_Context)& theContext); |
273 | |
274 | |
275 | public: //! @name PCurve construction |
276 | |
277 | //! Makes 2d curve of the edge <theE> on the faces <theF1> and <theF2>.<br> |
278 | //! <theContext> - storage for caching the geometrical tools |
279 | Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE, |
280 | const TopoDS_Face& theF1, |
281 | const TopoDS_Face& theF2, |
282 | const IntTools_Curve& theCurve, |
283 | const Standard_Boolean thePC1, |
284 | const Standard_Boolean thePC2, |
285 | const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)()); |
286 | |
287 | |
288 | public: //! @name Wire classification relatively face |
289 | |
290 | //! Checks if the wire is a hole for the face. |
291 | Standard_EXPORT static Standard_Boolean IsHole(const TopoDS_Shape& theW, |
292 | const TopoDS_Shape& theF); |
293 | |
294 | |
295 | public: //! @name Choosing correct orientation for the split shape |
296 | |
297 | //! Checks if the direction of the split shape is opposite to |
298 | //! the direction of the original shape. |
299 | //! The method is an overload for (Edge,Edge) and (Face,Face) corresponding |
300 | //! methods and checks only these types of shapes. |
301 | //! For faces the method checks if normal directions are opposite. |
302 | //! For edges the method checks if tangent vectors are opposite. |
303 | //! |
304 | //! In case the directions do not coincide, it returns TRUE, meaning |
305 | //! that split shape has to be reversed to match the direction of the |
306 | //! original shape. |
307 | //! |
308 | //! If requested (<theError> is not null), the method returns the status of the operation: |
309 | //! - 0 - no error; |
310 | //! - Error from (Edge,Edge) or (Face,Face) corresponding method |
311 | //! - 100 - bad types. |
312 | //! In case of any error the method always returns FALSE. |
313 | //! |
314 | //! @param theSplit [in] Split shape |
315 | //! @param theShape [in] Original shape |
316 | //! @param theContext [in] Cashed geometrical tools |
317 | //! @param theError [out] Error Status of the operation |
318 | Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit, |
319 | const TopoDS_Shape& theShape, |
320 | const Handle(IntTools_Context)& theContext, |
321 | Standard_Integer *theError = NULL); |
322 | |
323 | //! Add-on for the *IsSplitToReverse()* to check for its errors |
324 | //! and in case of any add the *BOPAlgo_AlertUnableToOrientTheShape* |
325 | //! warning to the report. |
326 | Standard_EXPORT static Standard_Boolean IsSplitToReverseWithWarn(const TopoDS_Shape& theSplit, |
327 | const TopoDS_Shape& theShape, |
328 | const Handle(IntTools_Context)& theContext, |
329 | const Handle(Message_Report)& theReport = NULL); |
330 | |
331 | //! Checks if the normal direction of the split face is opposite to |
332 | //! the normal direction of the original face. |
333 | //! The normal directions for both faces are taken in the same point - |
334 | //! point inside the split face is projected onto the original face. |
335 | //! Returns TRUE if the normals do not coincide, meaning the necessity |
336 | //! to revert the orientation of the split face to match the direction |
337 | //! of the original face. |
338 | //! |
339 | //! If requested (<theError> is not null), the method returns the status of the operation: |
340 | //! - 0 - no error; |
341 | //! - 1 - unable to find the point inside split face; |
342 | //! - 2 - unable to compute the normal for the split face; |
343 | //! - 3 - unable to project the point inside the split face on the original face; |
344 | //! - 4 - unable to compute the normal for the original face. |
345 | //! In case of any error the method always returns FALSE. |
346 | //! |
347 | //! @param theSplit [in] Split face |
348 | //! @param theShape [in] Original face |
349 | //! @param theContext [in] Cashed geometrical tools |
350 | //! @param theError [out] Error Status of the operation |
351 | Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit, |
352 | const TopoDS_Face& theShape, |
353 | const Handle(IntTools_Context)& theContext, |
354 | Standard_Integer *theError = NULL); |
355 | |
356 | //! Checks if the tangent vector of the split edge is opposite to |
357 | //! the tangent vector of the original edge. |
358 | //! The tangent vectors for both edges are computed in the same point - |
359 | //! point inside the split edge is projected onto the original edge. |
360 | //! Returns TRUE if the tangent vectors do not coincide, meaning the necessity |
361 | //! to revert the orientation of the split edge to match the direction |
362 | //! of the original edge. |
363 | //! |
364 | //! If requested (<theError> is not null), the method returns the status of the operation: |
365 | //! - 0 - no error; |
366 | //! - 1 - degenerated edges are given; |
367 | //! - 2 - unable to compute the tangent vector for the split edge; |
368 | //! - 3 - unable to project the point inside the split edge on the original edge; |
369 | //! - 4 - unable to compute the tangent vector for the original edge; |
370 | //! In case of any error the method always returns FALSE. |
371 | //! |
372 | //! @param theSplit [in] Split edge |
373 | //! @param theShape [in] Original edge |
374 | //! @param theContext [in] Cashed geometrical tools |
375 | //! @param theError [out] Error Status of the operation |
376 | Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit, |
377 | const TopoDS_Edge& theShape, |
378 | const Handle(IntTools_Context)& theContext, |
379 | Standard_Integer *theError = NULL); |
380 | |
381 | //! Checks if the normals direction of the given faces computed near |
382 | //! the shared edge coincide. |
383 | //! Returns the status of operation: |
384 | //! * 0 - in case of error (shared edge not found or directions are not collinear) |
385 | //! * 1 - normal directions coincide; |
386 | //! * -1 - normal directions are opposite. |
387 | Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1, |
388 | const TopoDS_Face& theF2, |
389 | const Handle(IntTools_Context)& theContext); |
390 | |
391 | public: //! @name Making connexity blocks |
392 | |
42cf5bc1 |
393 | //! For the list of faces theLS build block |
394 | //! theLSCB in terms of connexity by edges |
395 | //! theMapAvoid - set of edges to avoid for |
396 | //! the treatment |
80d55adf |
397 | Standard_EXPORT static void MakeConnexityBlock(TopTools_ListOfShape& theLS, |
398 | TopTools_IndexedMapOfShape& theMapAvoid, |
399 | TopTools_ListOfShape& theLSCB, |
400 | const Handle(NCollection_BaseAllocator)& theAllocator); |
98b37659 |
401 | |
402 | //! For the compound <theS> builds the blocks (compounds) of |
403 | //! elements of type <theElementType> connected through the shapes |
404 | //! of the type <theConnectionType>. |
405 | //! The blocks are stored into the list <theLCB>. |
406 | Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS, |
407 | const TopAbs_ShapeEnum theConnectionType, |
408 | const TopAbs_ShapeEnum theElementType, |
1155d05a |
409 | TopTools_ListOfShape& theLCB); |
98b37659 |
410 | |
411 | //! For the compound <theS> builds the blocks (compounds) of |
412 | //! elements of type <theElementType> connected through the shapes |
413 | //! of the type <theConnectionType>. |
414 | //! The blocks are stored into the list of lists <theLCB>. |
415 | //! Returns also the connection map <theConnectionMap>, filled during operation. |
416 | Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS, |
417 | const TopAbs_ShapeEnum theConnectionType, |
418 | const TopAbs_ShapeEnum theElementType, |
1155d05a |
419 | TopTools_ListOfListOfShape& theLCB, |
420 | TopTools_IndexedDataMapOfShapeListOfShape& theConnectionMap); |
98b37659 |
421 | |
422 | //! Makes connexity blocks of elements of the given type with the given type of the |
423 | //! connecting elements. The blocks are checked on regularity (multi-connectivity) |
424 | //! and stored to the list of blocks <theLCB>. |
1155d05a |
425 | Standard_EXPORT static void MakeConnexityBlocks(const TopTools_ListOfShape& theLS, |
98b37659 |
426 | const TopAbs_ShapeEnum theConnectionType, |
427 | const TopAbs_ShapeEnum theElementType, |
428 | BOPTools_ListOfConnexityBlock& theLCB); |
77a11d3d |
429 | |
80d55adf |
430 | public: //! @name Orienting elements in container |
431 | |
77a11d3d |
432 | //! Correctly orients edges on the wire |
80d55adf |
433 | Standard_EXPORT static void OrientEdgesOnWire(TopoDS_Shape& theWire); |
77a11d3d |
434 | |
435 | //! Correctly orients faces on the shell |
80d55adf |
436 | Standard_EXPORT static void OrientFacesOnShell(TopoDS_Shape& theShell); |
437 | |
438 | |
439 | public: //! @name Methods for shape validation (correction) |
42cf5bc1 |
440 | |
441 | //! Provides valid values of tolerances for the shape <theS> |
442 | //! <theTolMax> is max value of the tolerance that can be |
443 | //! accepted for correction. If real value of the tolerance |
444 | //! will be greater than <aTolMax>, the correction does not |
445 | //! perform. |
80d55adf |
446 | Standard_EXPORT static void CorrectTolerances(const TopoDS_Shape& theS, |
447 | const TopTools_IndexedMapOfShape& theMapToAvoid, |
448 | const Standard_Real theTolMax = 0.0001, |
449 | const Standard_Boolean theRunParallel = Standard_False); |
42cf5bc1 |
450 | |
451 | //! Provides valid values of tolerances for the shape <theS> |
452 | //! in terms of BRepCheck_InvalidCurveOnSurface. |
80d55adf |
453 | Standard_EXPORT static void CorrectCurveOnSurface(const TopoDS_Shape& theS, |
454 | const TopTools_IndexedMapOfShape& theMapToAvoid, |
455 | const Standard_Real theTolMax = 0.0001, |
456 | const Standard_Boolean theRunParallel = Standard_False); |
42cf5bc1 |
457 | |
458 | //! Provides valid values of tolerances for the shape <theS> |
459 | //! in terms of BRepCheck_InvalidPointOnCurve. |
80d55adf |
460 | Standard_EXPORT static void CorrectPointOnCurve(const TopoDS_Shape& theS, |
461 | const TopTools_IndexedMapOfShape& theMapToAvoid, |
462 | const Standard_Real theTolMax = 0.0001, |
463 | const Standard_Boolean theRunParallel = Standard_False); |
42cf5bc1 |
464 | |
80d55adf |
465 | //! Corrects tolerance values of the sub-shapes of the shape <theS> if needed. |
466 | Standard_EXPORT static void CorrectShapeTolerances(const TopoDS_Shape& theS, |
467 | const TopTools_IndexedMapOfShape& theMapToAvoid, |
468 | const Standard_Boolean theRunParallel = Standard_False); |
42cf5bc1 |
469 | |
42cf5bc1 |
470 | |
80d55adf |
471 | public: //! Checking if the faces are coinciding |
56c62737 |
472 | |
80d55adf |
473 | //! Checks if the given faces are same-domain, i.e. coincide. |
474 | Standard_EXPORT static Standard_Boolean AreFacesSameDomain(const TopoDS_Face& theF1, |
475 | const TopoDS_Face& theF2, |
476 | const Handle(IntTools_Context)& theContext, |
477 | const Standard_Real theFuzz = Precision::Confusion()); |
42cf5bc1 |
478 | |
80d55adf |
479 | public: //! @name Looking for the edge in the face |
42cf5bc1 |
480 | |
80d55adf |
481 | //! Returns True if the face theFace contains |
482 | //! the edge theEdge but with opposite orientation. |
483 | //! If the method returns True theEdgeOff is the |
484 | //! edge founded |
485 | Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge, |
486 | const TopoDS_Face& theFace, |
487 | TopoDS_Edge& theEdgeOff); |
42cf5bc1 |
488 | |
80d55adf |
489 | //! For the face theFace gets the edge theEdgeOnF |
490 | //! that is the same as theEdge |
491 | //! Returns True if such edge exists |
492 | //! Returns False if there is no such edge |
493 | Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge, |
494 | const TopoDS_Face& theFace, |
495 | TopoDS_Edge& theEdgeOnF); |
42cf5bc1 |
496 | |
42cf5bc1 |
497 | |
80d55adf |
498 | public: //! @name Correction of the edges range |
42cf5bc1 |
499 | |
500 | //! Correct shrunk range <aSR> taking into account 3D-curve |
80d55adf |
501 | //! resolution and corresponding tolerance values of <aE1>, <aE2> |
502 | Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE1, |
503 | const TopoDS_Edge& aE2, |
504 | const IntTools_Range& aSR, |
505 | IntTools_Range& aNewSR); |
42cf5bc1 |
506 | |
507 | |
508 | //! Correct shrunk range <aSR> taking into account 3D-curve |
80d55adf |
509 | //! resolution and corresponding tolerance values of <aE>, <aF> |
510 | Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE, |
511 | const TopoDS_Face& aF, |
512 | const IntTools_Range& aSR, |
513 | IntTools_Range& aNewSR); |
42cf5bc1 |
514 | |
80d55adf |
515 | public: //! @name Checking edge on micro status |
42cf5bc1 |
516 | |
01b5b3df |
517 | //! Checks if it is possible to compute shrunk range for the edge <aE> |
518 | //! Flag <theCheckSplittable> defines whether to take into account |
80d55adf |
519 | //! the possibility to split the edge or not. |
520 | Standard_EXPORT static Standard_Boolean IsMicroEdge(const TopoDS_Edge& theEdge, |
521 | const Handle(IntTools_Context)& theContext, |
522 | const Standard_Boolean theCheckSplittable = Standard_True); |
42cf5bc1 |
523 | |
80d55adf |
524 | public: //! @name Solid classification |
42cf5bc1 |
525 | |
42cf5bc1 |
526 | //! Returns true if the solid <theSolid> is inverted |
80d55adf |
527 | Standard_EXPORT static Standard_Boolean IsInvertedSolid(const TopoDS_Solid& theSolid); |
528 | |
529 | public: //! @name Edge/Face Deviation computation |
42cf5bc1 |
530 | |
531 | //! Computes the necessary value of the tolerance for the edge |
80d55adf |
532 | Standard_EXPORT static Standard_Boolean ComputeTolerance(const TopoDS_Face& theFace, |
533 | const TopoDS_Edge& theEdge, |
534 | Standard_Real& theMaxDist, |
535 | Standard_Real& theMaxPar); |
42cf5bc1 |
536 | |
80d55adf |
537 | public: //! @name Other methods |
42cf5bc1 |
538 | |
80d55adf |
539 | //! Makes empty container of requested type |
540 | Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType, |
541 | TopoDS_Shape& theShape); |
42cf5bc1 |
542 | |
80d55adf |
543 | //! Compute a 3D-point on the edge <aEdge> at parameter <aPrm> |
544 | Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aEdge, |
545 | const Standard_Real aPrm, |
546 | gp_Pnt& aP); |
42cf5bc1 |
547 | |
80d55adf |
548 | //! Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e |
549 | //! the <PB> is IN or ON in 2D of <aF> |
550 | Standard_EXPORT static Standard_Boolean IsBlockInOnFace(const IntTools_Range& aShR, |
551 | const TopoDS_Face& aF, |
552 | const TopoDS_Edge& aE, |
553 | const Handle(IntTools_Context)& aContext); |
554 | |
555 | //! Retutns dimension of the shape <theS>. |
556 | Standard_EXPORT static Standard_Integer Dimension(const TopoDS_Shape& theS); |
557 | |
558 | //! Returns true if the shell <theShell> is open |
559 | Standard_EXPORT static Standard_Boolean IsOpenShell(const TopoDS_Shell& theShell); |
42cf5bc1 |
560 | |
42cf5bc1 |
561 | }; |
562 | |
42cf5bc1 |
563 | #endif // _BOPTools_AlgoTools_HeaderFile |