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