Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:05

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 2010-2014 OPEN CASCADE SAS
0003 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
0004 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
0005 //                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
0006 //
0007 // This file is part of Open CASCADE Technology software library.
0008 //
0009 // This library is free software; you can redistribute it and/or modify it under
0010 // the terms of the GNU Lesser General Public License version 2.1 as published
0011 // by the Free Software Foundation, with special exception defined in the file
0012 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0013 // distribution for complete text of the license and disclaimer of any warranty.
0014 //
0015 // Alternatively, this file may be used under the terms of Open CASCADE
0016 // commercial license or contractual agreement.
0017 
0018 #ifndef _BOPTools_AlgoTools_HeaderFile
0019 #define _BOPTools_AlgoTools_HeaderFile
0020 
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Handle.hxx>
0024 
0025 #include <Standard_Boolean.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <Standard_Real.hxx>
0028 #include <BOPTools_ListOfCoupleOfShape.hxx>
0029 #include <BOPTools_ListOfConnexityBlock.hxx>
0030 #include <NCollection_BaseAllocator.hxx>
0031 #include <TopAbs_State.hxx>
0032 #include <TopAbs_ShapeEnum.hxx>
0033 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0034 #include <TopTools_IndexedMapOfShape.hxx>
0035 #include <TopTools_MapOfShape.hxx>
0036 #include <TopTools_ListOfListOfShape.hxx>
0037 #include <TopTools_ListOfShape.hxx>
0038 #include <Precision.hxx>
0039 class TopoDS_Vertex;
0040 class gp_Pnt;
0041 class IntTools_Curve;
0042 class TopoDS_Edge;
0043 class TopoDS_Face;
0044 class TopoDS_Shape;
0045 class IntTools_Context;
0046 class TopoDS_Solid;
0047 class IntTools_Range;
0048 class TopoDS_Shell;
0049 class Message_Report;
0050 
0051 //! Provides tools used in Boolean Operations algorithm:
0052 //! - Vertices intersection;
0053 //! - Vertex construction;
0054 //! - Edge construction;
0055 //! - Classification algorithms;
0056 //! - Making connexity blocks;
0057 //! - Shape validation.
0058 class BOPTools_AlgoTools
0059 {
0060 public:
0061 
0062   DEFINE_STANDARD_ALLOC
0063 
0064 public: //! @name Constants
0065 
0066   //! Additional tolerance (delta tolerance) is used in Boolean Operations
0067   //! to ensure that the tolerance of new/old entities obtained
0068   //! by intersection of two shapes is slightly bigger than the actual
0069   //! distances to these shapes. It helps to avoid numerical instability
0070   //! which may occur when comparing distances and tolerances.
0071   static Standard_Real DTolerance() { return 1.e-12; }
0072 
0073 public: //! @name Intersection of the vertices
0074 
0075   //! Intersects the vertex <theV1> with the point <theP> with tolerance <theTolP>.
0076   //! Returns the error status:
0077   //! - 0 - no error, meaning that the vertex intersects the point;
0078   //! - 1 - the distance between vertex and point is grater than the sum of tolerances.
0079   Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& theV,
0080                                                     const gp_Pnt& theP,
0081                                                     const Standard_Real theTolP);
0082 
0083   //! Intersects the given vertices with given fuzzy value.
0084   //! Returns the error status:
0085   //! - 0 - no error, meaning that the vertices interferes with given tolerance;
0086   //! - 1 - the distance between vertices is grater than the sum of their tolerances.
0087   Standard_EXPORT static Standard_Integer ComputeVV(const TopoDS_Vertex& theV1,
0088                                                     const TopoDS_Vertex& theV2,
0089                                                     const Standard_Real theFuzz = Precision::Confusion());
0090 
0091 public: //! @name Vertices construction
0092 
0093   //! Makes the vertex in the middle of given vertices with
0094   //! the tolerance covering all tolerance spheres of vertices.
0095   Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV,
0096                                          TopoDS_Vertex& theV);
0097 
0098   //! Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol>
0099   Standard_EXPORT static void MakeNewVertex(const gp_Pnt& aP1,
0100                                             const Standard_Real aTol,
0101                                             TopoDS_Vertex& aNewVertex);
0102 
0103   //! Make a vertex using couple of vertices  <aV1, aV2>
0104   Standard_EXPORT static void MakeNewVertex(const TopoDS_Vertex& aV1,
0105                                             const TopoDS_Vertex& aV2,
0106                                             TopoDS_Vertex& aNewVertex);
0107 
0108   //! Make a vertex in place of intersection between two edges
0109   //! <aE1, aE2> with parameters <aP1, aP2>
0110   Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1,
0111                                             const Standard_Real aP1,
0112                                             const TopoDS_Edge& aE2,
0113                                             const Standard_Real aP2,
0114                                             TopoDS_Vertex& aNewVertex);
0115 
0116   //! Make a vertex in place of intersection between the edge <aE1>
0117   //! with parameter <aP1> and the face <aF2>
0118   Standard_EXPORT static void MakeNewVertex(const TopoDS_Edge& aE1,
0119                                             const Standard_Real aP1,
0120                                             const TopoDS_Face& aF2,
0121                                             TopoDS_Vertex& aNewVertex);
0122 
0123 
0124 public: //! @name Updating the vertex
0125 
0126   //! Update the tolerance value for vertex  <aV>
0127   //! taking into account the fact that <aV> lays on
0128   //! the curve <aIC>
0129   Standard_EXPORT static void UpdateVertex(const IntTools_Curve& aIC,
0130                                            const Standard_Real aT,
0131                                            const TopoDS_Vertex& aV);
0132 
0133   //! Update the tolerance value for vertex  <aV>
0134   //! taking into account the fact that <aV> lays on
0135   //! the edge <aE>
0136   Standard_EXPORT static void UpdateVertex(const TopoDS_Edge& aE,
0137                                            const Standard_Real aT,
0138                                            const TopoDS_Vertex& aV);
0139 
0140   //! Update the tolerance value for vertex  <aVN>
0141   //! taking into account the fact that <aVN> should
0142   //! cover tolerance zone of <aVF>
0143   Standard_EXPORT static void UpdateVertex(const TopoDS_Vertex& aVF,
0144                                            const TopoDS_Vertex& aVN);
0145 
0146 
0147 public: //! @name Edge construction
0148 
0149   //! Makes the edge based on the given curve with given bounding vertices.
0150   Standard_EXPORT static void MakeEdge(const IntTools_Curve& theCurve,
0151                                        const TopoDS_Vertex& theV1,
0152                                        const Standard_Real theT1,
0153                                        const TopoDS_Vertex& theV2,
0154                                        const Standard_Real theT2,
0155                                        const Standard_Real theTolR3D,
0156                                        TopoDS_Edge& theE);
0157 
0158   //! Makes a copy of <theEdge> with vertices.
0159   Standard_EXPORT static TopoDS_Edge CopyEdge(const TopoDS_Edge& theEdge);
0160 
0161   //! Make the edge from base edge <aE1> and two vertices <aV1,aV2>
0162   //! at parameters <aP1,aP2>
0163   Standard_EXPORT static void MakeSplitEdge(const TopoDS_Edge& aE1,
0164                                             const TopoDS_Vertex& aV1,
0165                                             const Standard_Real aP1,
0166                                             const TopoDS_Vertex& aV2,
0167                                             const Standard_Real aP2,
0168                                             TopoDS_Edge& aNewEdge);
0169 
0170   //! Make the edge from 3D-Curve <aIC>  and two vertices <aV1,aV2>
0171   //! at parameters <aP1,aP2>
0172   Standard_EXPORT static void MakeSectEdge(const IntTools_Curve& aIC,
0173                                            const TopoDS_Vertex& aV1,
0174                                            const Standard_Real aP1,
0175                                            const TopoDS_Vertex& aV2,
0176                                            const Standard_Real aP2,
0177                                            TopoDS_Edge& aNewEdge);
0178 
0179 
0180 public: //! @name Point/Edge/Face classification relatively solid
0181 
0182   //! Computes the 3-D state of the point thePoint
0183   //! toward solid theSolid.
0184   //! theTol - value of precision of computation
0185   //! theContext- cahed geometrical tools
0186   //! Returns 3-D state.
0187   Standard_EXPORT static TopAbs_State ComputeState(const gp_Pnt& thePoint,
0188                                                    const TopoDS_Solid& theSolid,
0189                                                    const Standard_Real theTol,
0190                                                    const Handle(IntTools_Context)& theContext);
0191   
0192   //! Computes the 3-D state of the vertex theVertex
0193   //! toward solid theSolid.
0194   //! theTol - value of precision of computation
0195   //! theContext- cahed geometrical tools
0196   //! Returns 3-D state.
0197   Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Vertex& theVertex,
0198                                                    const TopoDS_Solid& theSolid,
0199                                                    const Standard_Real theTol,
0200                                                    const Handle(IntTools_Context)& theContext);
0201   
0202   //! Computes the 3-D state of the edge theEdge
0203   //! toward solid theSolid.
0204   //! theTol - value of precision of computation
0205   //! theContext- cahed geometrical tools
0206   //! Returns 3-D state.
0207   Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Edge& theEdge,
0208                                                   const TopoDS_Solid& theSolid,
0209                                                   const Standard_Real theTol,
0210                                                   const Handle(IntTools_Context)& theContext);
0211   
0212   //! Computes the 3-D state of the face theFace
0213   //! toward solid theSolid.
0214   //! theTol - value of precision of computation
0215   //! theBounds - set of edges of <theSolid> to avoid
0216   //! theContext- cahed geometrical tools
0217   //! Returns 3-D state.
0218   Standard_EXPORT static TopAbs_State ComputeState(const TopoDS_Face& theFace,
0219                                                    const TopoDS_Solid& theSolid,
0220                                                    const Standard_Real theTol,
0221                                                    const TopTools_IndexedMapOfShape& theBounds,
0222                                                    const Handle(IntTools_Context)& theContext);
0223   
0224   //! Computes the 3-D state of the shape theShape
0225   //! toward solid theSolid.
0226   //! theTol - value of precision of computation
0227   //! theContext- cahed geometrical tools
0228   //! Returns 3-D state.
0229   Standard_EXPORT static TopAbs_State ComputeStateByOnePoint(const TopoDS_Shape& theShape,
0230                                                              const TopoDS_Solid& theSolid,
0231                                                              const Standard_Real theTol,
0232                                                              const Handle(IntTools_Context)& theContext);
0233 
0234 
0235 public: //! @name Face classification relatively solid
0236 
0237   //! For the face theFace and its edge theEdge
0238   //! finds the face suitable to produce shell.
0239   //! theLCEF - set of faces to search. All faces
0240   //! from theLCEF must share edge theEdge
0241   Standard_EXPORT static Standard_Boolean GetFaceOff(const TopoDS_Edge& theEdge,
0242                                                      const TopoDS_Face& theFace,
0243                                                      BOPTools_ListOfCoupleOfShape& theLCEF,
0244                                                      TopoDS_Face& theFaceOff,
0245                                                      const Handle(IntTools_Context)& theContext);
0246 
0247   //! Returns True if the face theFace is inside of the
0248   //! couple of faces theFace1, theFace2.
0249   //! The faces theFace, theFace1, theFace2  must
0250   //! share the edge theEdge
0251   //! Return values:
0252   //!  * 0 state is not IN
0253   //!  * 1 state is IN
0254   //!  * 2 state can not be found by the method of angles
0255   Standard_EXPORT static Standard_Integer IsInternalFace(const TopoDS_Face& theFace,
0256                                                          const TopoDS_Edge& theEdge,
0257                                                          const TopoDS_Face& theFace1,
0258                                                          const TopoDS_Face& theFace2,
0259                                                          const Handle(IntTools_Context)& theContext);
0260 
0261   //! Returns True if the face theFace is inside of the
0262   //! appropriate couple of faces (from the set theLF)    .
0263   //! The faces of the set theLF and theFace  must
0264   //! share the edge theEdge
0265   //!  * 0 state is not IN
0266   //!  * 1 state is IN
0267   //!  * 2 state can not be found by the method of angles
0268   Standard_EXPORT static Standard_Integer IsInternalFace(const TopoDS_Face& theFace,
0269                                                          const TopoDS_Edge& theEdge,
0270                                                          TopTools_ListOfShape& theLF,
0271                                                          const Handle(IntTools_Context)& theContext);
0272 
0273   //! Returns True if the face theFace is inside the
0274   //! solid theSolid.
0275   //! theMEF - Map Edge/Faces for theSolid
0276   //! theTol - value of precision of computation
0277   //! theContext- cahed geometrical tools
0278   Standard_EXPORT static Standard_Boolean IsInternalFace(const TopoDS_Face& theFace,
0279                                                          const TopoDS_Solid& theSolid,
0280                                                          TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
0281                                                          const Standard_Real theTol,
0282                                                          const Handle(IntTools_Context)& theContext);
0283 
0284 
0285 public: //! @name PCurve construction
0286 
0287   //! Makes 2d curve of the edge <theE> on the faces <theF1> and <theF2>.<br>
0288   //! <theContext> - storage for caching the geometrical tools
0289   Standard_EXPORT static void MakePCurve (const TopoDS_Edge& theE,
0290                                           const TopoDS_Face& theF1,
0291                                           const TopoDS_Face& theF2,
0292                                           const IntTools_Curve& theCurve,
0293                                           const Standard_Boolean thePC1,
0294                                           const Standard_Boolean thePC2,
0295                                           const Handle(IntTools_Context)& theContext = Handle(IntTools_Context)());
0296 
0297 
0298 public: //! @name Wire classification relatively face
0299 
0300   //! Checks if the wire is a hole for the face.
0301   Standard_EXPORT static Standard_Boolean IsHole(const TopoDS_Shape& theW,
0302                                                  const TopoDS_Shape& theF);
0303 
0304 
0305 public: //! @name Choosing correct orientation for the split shape
0306 
0307   //! Checks if the direction of the split shape is opposite to
0308   //! the direction of the original shape.
0309   //! The method is an overload for (Edge,Edge) and (Face,Face) corresponding
0310   //! methods and checks only these types of shapes.
0311   //! For faces the method checks if normal directions are opposite.
0312   //! For edges the method checks if tangent vectors are opposite.
0313   //!
0314   //! In case the directions do not coincide, it returns TRUE, meaning
0315   //! that split shape has to be reversed to match the direction of the
0316   //! original shape.
0317   //!
0318   //! If requested (<theError> is not null), the method returns the status of the operation:
0319   //! - 0 - no error;
0320   //! - Error from (Edge,Edge) or (Face,Face) corresponding method
0321   //! - 100 - bad types.
0322   //! In case of any error the method always returns FALSE.
0323   //!
0324   //! @param theSplit [in] Split shape
0325   //! @param theShape [in] Original shape
0326   //! @param theContext [in] cached geometrical tools
0327   //! @param theError [out] Error Status of the operation
0328   Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Shape& theSplit,
0329                                                            const TopoDS_Shape& theShape,
0330                                                            const Handle(IntTools_Context)& theContext,
0331                                                            Standard_Integer *theError = NULL);
0332 
0333   //! Add-on for the *IsSplitToReverse()* to check for its errors
0334   //! and in case of any add the *BOPAlgo_AlertUnableToOrientTheShape*
0335   //! warning to the report.
0336   Standard_EXPORT static Standard_Boolean IsSplitToReverseWithWarn(const TopoDS_Shape& theSplit,
0337                                                                    const TopoDS_Shape& theShape,
0338                                                                    const Handle(IntTools_Context)& theContext,
0339                                                                    const Handle(Message_Report)& theReport = NULL);
0340 
0341   //! Checks if the normal direction of the split face is opposite to
0342   //! the normal direction of the original face.
0343   //! The normal directions for both faces are taken in the same point -
0344   //! point inside the split face is projected onto the original face.
0345   //! Returns TRUE if the normals do not coincide, meaning the necessity
0346   //! to revert the orientation of the split face to match the direction
0347   //! of the original face.
0348   //!
0349   //! If requested (<theError> is not null), the method returns the status of the operation:
0350   //! - 0 - no error;
0351   //! - 1 - unable to find the point inside split face;
0352   //! - 2 - unable to compute the normal for the split face;
0353   //! - 3 - unable to project the point inside the split face on the original face;
0354   //! - 4 - unable to compute the normal for the original face.
0355   //! In case of any error the method always returns FALSE.
0356   //!
0357   //! @param theSplit [in] Split face
0358   //! @param theShape [in] Original face
0359   //! @param theContext [in] cached geometrical tools
0360   //! @param theError [out] Error Status of the operation
0361   Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Face& theSplit,
0362                                                            const TopoDS_Face& theShape,
0363                                                            const Handle(IntTools_Context)& theContext,
0364                                                            Standard_Integer *theError = NULL);
0365 
0366   //! Checks if the tangent vector of the split edge is opposite to
0367   //! the tangent vector of the original edge.
0368   //! The tangent vectors for both edges are computed in the same point -
0369   //! point inside the split edge is projected onto the original edge.
0370   //! Returns TRUE if the tangent vectors do not coincide, meaning the necessity
0371   //! to revert the orientation of the split edge to match the direction
0372   //! of the original edge.
0373   //!
0374   //! If requested (<theError> is not null), the method returns the status of the operation:
0375   //! - 0 - no error;
0376   //! - 1 - degenerated edges are given;
0377   //! - 2 - unable to compute the tangent vector for the split edge;
0378   //! - 3 - unable to project the point inside the split edge on the original edge;
0379   //! - 4 - unable to compute the tangent vector for the original edge;
0380   //! In case of any error the method always returns FALSE.
0381   //!
0382   //! @param theSplit [in] Split edge
0383   //! @param theShape [in] Original edge
0384   //! @param theContext [in] cached geometrical tools
0385   //! @param theError [out] Error Status of the operation
0386   Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
0387                                                            const TopoDS_Edge& theShape,
0388                                                            const Handle(IntTools_Context)& theContext,
0389                                                            Standard_Integer *theError = NULL);
0390 
0391   //! Checks if the normals direction of the given faces computed near
0392   //! the shared edge coincide.
0393   //! Returns the status of operation:
0394   //! * 0 - in case of error (shared edge not found or directions are not collinear)
0395   //! * 1 - normal directions coincide;
0396   //! * -1 - normal directions are opposite.
0397   Standard_EXPORT static Standard_Integer Sense(const TopoDS_Face& theF1,
0398                                                 const TopoDS_Face& theF2,
0399                                                 const Handle(IntTools_Context)& theContext);
0400 
0401 public: //! @name Making connexity blocks
0402 
0403   //! For the list of faces theLS build block
0404   //! theLSCB in terms of connexity by edges
0405   //! theMapAvoid - set of edges to avoid for
0406   //! the treatment
0407   Standard_EXPORT static void MakeConnexityBlock(TopTools_ListOfShape& theLS,
0408                                                  TopTools_IndexedMapOfShape& theMapAvoid,
0409                                                  TopTools_ListOfShape& theLSCB,
0410                                                  const Handle(NCollection_BaseAllocator)& theAllocator);
0411 
0412   //! For the compound <theS> builds the blocks (compounds) of
0413   //! elements of type <theElementType> connected through the shapes
0414   //! of the type <theConnectionType>.
0415   //! The blocks are stored into the list <theLCB>.
0416   Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS,
0417                                                   const TopAbs_ShapeEnum theConnectionType,
0418                                                   const TopAbs_ShapeEnum theElementType,
0419                                                   TopTools_ListOfShape& theLCB);
0420 
0421   //! For the compound <theS> builds the blocks (compounds) of
0422   //! elements of type <theElementType> connected through the shapes
0423   //! of the type <theConnectionType>.
0424   //! The blocks are stored into the list of lists <theLCB>.
0425   //! Returns also the connection map <theConnectionMap>, filled during operation.
0426   Standard_EXPORT static void MakeConnexityBlocks(const TopoDS_Shape& theS,
0427                                                   const TopAbs_ShapeEnum theConnectionType,
0428                                                   const TopAbs_ShapeEnum theElementType,
0429                                                   TopTools_ListOfListOfShape& theLCB,
0430                                                   TopTools_IndexedDataMapOfShapeListOfShape& theConnectionMap);
0431 
0432   //! Makes connexity blocks of elements of the given type with the given type of the
0433   //! connecting elements. The blocks are checked on regularity (multi-connectivity)
0434   //! and stored to the list of blocks <theLCB>.
0435   Standard_EXPORT static void MakeConnexityBlocks(const TopTools_ListOfShape& theLS,
0436                                                   const TopAbs_ShapeEnum theConnectionType,
0437                                                   const TopAbs_ShapeEnum theElementType,
0438                                                   BOPTools_ListOfConnexityBlock& theLCB);
0439 
0440 public: //! @name Orienting elements in container
0441 
0442   //! Correctly orients edges on the wire
0443   Standard_EXPORT static void OrientEdgesOnWire(TopoDS_Shape& theWire);
0444 
0445   //! Correctly orients faces on the shell
0446   Standard_EXPORT static void OrientFacesOnShell(TopoDS_Shape& theShell);
0447 
0448 
0449 public: //! @name Methods for shape validation (correction)
0450 
0451   //! Provides valid values of tolerances for the shape <theS>
0452   //! <theTolMax> is max value of the tolerance that can be
0453   //! accepted for correction.  If real value of the tolerance
0454   //! will be greater than  <aTolMax>, the correction does not
0455   //! perform.
0456   Standard_EXPORT static void CorrectTolerances(const TopoDS_Shape& theS, 
0457                                                 const TopTools_IndexedMapOfShape& theMapToAvoid,
0458                                                 const Standard_Real theTolMax = 0.0001,
0459                                                 const Standard_Boolean theRunParallel = Standard_False);
0460 
0461   //! Provides valid values of tolerances for the shape <theS>
0462   //! in  terms of BRepCheck_InvalidCurveOnSurface.
0463   Standard_EXPORT static void CorrectCurveOnSurface(const TopoDS_Shape& theS,
0464                                                     const TopTools_IndexedMapOfShape& theMapToAvoid,
0465                                                     const Standard_Real theTolMax = 0.0001,
0466                                                     const Standard_Boolean theRunParallel = Standard_False);
0467 
0468   //! Provides valid values of tolerances for the shape <theS>
0469   //! in  terms of BRepCheck_InvalidPointOnCurve.
0470   Standard_EXPORT static void CorrectPointOnCurve(const TopoDS_Shape& theS,
0471                                                   const TopTools_IndexedMapOfShape& theMapToAvoid,
0472                                                   const Standard_Real theTolMax = 0.0001,
0473                                                   const Standard_Boolean theRunParallel = Standard_False);
0474 
0475   //! Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
0476   Standard_EXPORT static void CorrectShapeTolerances(const TopoDS_Shape& theS,
0477                                                      const TopTools_IndexedMapOfShape& theMapToAvoid,
0478                                                      const Standard_Boolean theRunParallel = Standard_False);
0479 
0480 
0481 public: //! Checking if the faces are coinciding
0482 
0483   //! Checks if the given faces are same-domain, i.e. coincide.
0484   Standard_EXPORT static Standard_Boolean AreFacesSameDomain(const TopoDS_Face& theF1,
0485                                                              const TopoDS_Face& theF2, 
0486                                                              const Handle(IntTools_Context)& theContext,
0487                                                              const Standard_Real theFuzz = Precision::Confusion());
0488 
0489 public: //! @name Looking for the edge in the face
0490 
0491   //! Returns True if the face theFace contains
0492   //! the edge theEdge but with opposite orientation.
0493   //! If the method  returns True theEdgeOff is the
0494   //! edge founded
0495   Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,
0496                                                      const TopoDS_Face& theFace,
0497                                                      TopoDS_Edge& theEdgeOff);
0498 
0499   //! For the face theFace gets the edge theEdgeOnF
0500   //! that is the same as theEdge
0501   //! Returns True if such edge exists
0502   //! Returns False if there is no such edge
0503   Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdge,
0504                                                         const TopoDS_Face& theFace,
0505                                                         TopoDS_Edge& theEdgeOnF);
0506 
0507 
0508 public: //! @name Correction of the edges range
0509 
0510   //! Correct shrunk range <aSR> taking into account 3D-curve
0511   //! resolution and corresponding tolerance values of <aE1>, <aE2>
0512   Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE1,
0513                                            const TopoDS_Edge& aE2,
0514                                            const IntTools_Range& aSR,
0515                                            IntTools_Range& aNewSR);
0516   
0517 
0518   //! Correct shrunk range <aSR> taking into account 3D-curve
0519   //! resolution and corresponding tolerance values of <aE>, <aF>
0520   Standard_EXPORT static void CorrectRange(const TopoDS_Edge& aE,
0521                                            const TopoDS_Face& aF,
0522                                            const IntTools_Range& aSR,
0523                                            IntTools_Range& aNewSR);
0524 
0525 public: //! @name Checking edge on micro status
0526 
0527   //! Checks if it is possible to compute shrunk range for the edge <aE>
0528   //! Flag <theCheckSplittable> defines whether to take into account 
0529   //! the possibility to split the edge or not.
0530   Standard_EXPORT static Standard_Boolean IsMicroEdge(const TopoDS_Edge& theEdge,
0531                                                       const Handle(IntTools_Context)& theContext,
0532                                                       const Standard_Boolean theCheckSplittable = Standard_True);
0533 
0534 public: //! @name Solid classification
0535 
0536   //! Returns true if the solid <theSolid> is inverted
0537   Standard_EXPORT static Standard_Boolean IsInvertedSolid(const TopoDS_Solid& theSolid);
0538 
0539 public: //! @name Edge/Face Deviation computation
0540 
0541   //! Computes the necessary value of the tolerance for the edge
0542   Standard_EXPORT static Standard_Boolean ComputeTolerance(const TopoDS_Face& theFace,
0543                                                            const TopoDS_Edge& theEdge,
0544                                                            Standard_Real& theMaxDist,
0545                                                            Standard_Real& theMaxPar);
0546 
0547 public: //! @name Other methods
0548 
0549   //! Makes empty container of requested type
0550   Standard_EXPORT static void MakeContainer(const TopAbs_ShapeEnum theType,
0551                                             TopoDS_Shape& theShape);
0552 
0553   //! Compute a 3D-point on the edge <aEdge> at parameter <aPrm>
0554   Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aEdge,
0555                                           const Standard_Real aPrm,
0556                                           gp_Pnt& aP);
0557 
0558   //! Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e
0559   //! the <PB> is IN or ON in 2D of <aF>
0560   Standard_EXPORT static Standard_Boolean IsBlockInOnFace(const IntTools_Range& aShR,
0561                                                           const TopoDS_Face& aF,
0562                                                           const TopoDS_Edge& aE,
0563                                                           const Handle(IntTools_Context)& aContext);
0564 
0565   //! Returns the min and max dimensions of the shape <theS>.
0566   Standard_EXPORT static void Dimensions (const TopoDS_Shape& theS,
0567                                           Standard_Integer& theDMin,
0568                                           Standard_Integer& theDMax);
0569 
0570   //! Returns dimension of the shape <theS>.
0571   //! If the shape contains elements of different dimension, -1 is returned.
0572   Standard_EXPORT static Standard_Integer Dimension(const TopoDS_Shape& theS);
0573 
0574   //! Collects in the output list recursively all non-compound sub-shapes of the first level
0575   //! of the given shape theS. The optional map theMap is used to avoid the duplicates in the
0576   //! output list, so it will also contain all non-compound sub-shapes.
0577   Standard_EXPORT static void TreatCompound (const TopoDS_Shape& theS,
0578                                              TopTools_ListOfShape& theList,
0579                                              TopTools_MapOfShape* theMap = NULL);
0580 
0581   //! Returns true if the  shell <theShell> is open
0582   Standard_EXPORT static Standard_Boolean IsOpenShell(const TopoDS_Shell& theShell);
0583 
0584 };
0585 
0586 #endif // _BOPTools_AlgoTools_HeaderFile