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