Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-28 09:15:54

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