Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 09:18:56

0001 // Created on: 1993-05-07
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopOpeBRep_ShapeIntersector_HeaderFile
0018 #define _TopOpeBRep_ShapeIntersector_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopOpeBRepTool_ShapeExplorer.hxx>
0025 #include <TopOpeBRep_ShapeScanner.hxx>
0026 #include <TopOpeBRep_FacesIntersector.hxx>
0027 #include <TopOpeBRep_EdgesIntersector.hxx>
0028 #include <TopOpeBRep_FaceEdgeIntersector.hxx>
0029 #include <TopoDS_Face.hxx>
0030 #include <Standard_Integer.hxx>
0031 #include <TopoDS_Shape.hxx>
0032 #include <NCollection_List.hxx>
0033 class TopOpeBRepTool_HBoxTool;
0034 
0035 //! Intersect two shapes.
0036 //!
0037 //! A GeomShape is a shape with a geometric domain, i.e.
0038 //! a Face or an Edge.
0039 //!
0040 //! The purpose of the ShapeIntersector is to find
0041 //! couples of intersecting GeomShape in two Shapes
0042 //! (which can be any kind of topologies : Compound,
0043 //! Solid, Shell, etc... )
0044 //!
0045 //! It is in charge of exploration of the shapes and
0046 //! rejection. For this it is provided with two tools:
0047 //!
0048 //! - ShapeExplorer from TopOpeBRepTool.
0049 //! - ShapeScanner from TopOpeBRep which implements bounding boxes.
0050 //!
0051 //! Let S1,S2 the shapes sent to InitIntersection(S1,S2) method:
0052 //! - S1 is always SCANNED by a ShapeScanner from TopOpeBRep.
0053 //! - S2 is always EXPLORED by a ShapeExplorer from TopOpeBRepTool.
0054 class TopOpeBRep_ShapeIntersector
0055 {
0056 public:
0057   DEFINE_STANDARD_ALLOC
0058 
0059   Standard_EXPORT TopOpeBRep_ShapeIntersector();
0060 
0061   //! Initialize the intersection of shapes S1,S2.
0062   Standard_EXPORT void InitIntersection(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0063 
0064   //! Initialize the intersection of shapes S1,S2.
0065   Standard_EXPORT void InitIntersection(const TopoDS_Shape& S1,
0066                                         const TopoDS_Shape& S2,
0067                                         const TopoDS_Face&  F1,
0068                                         const TopoDS_Face&  F2);
0069 
0070   //! return the shape <Index> ( = 1 or 2) given to
0071   //! InitIntersection().
0072   //! Index = 1 will return S1, Index = 2 will return S2.
0073   Standard_EXPORT const TopoDS_Shape& Shape(const int Index) const;
0074 
0075   //! returns True if there are more intersection
0076   //! between two the shapes.
0077   Standard_EXPORT bool MoreIntersection() const;
0078 
0079   //! search for the next intersection between the two shapes.
0080   Standard_EXPORT void NextIntersection();
0081 
0082   //! return the current intersection of two Faces.
0083   Standard_EXPORT TopOpeBRep_FacesIntersector& ChangeFacesIntersector();
0084 
0085   //! return the current intersection of two Edges.
0086   Standard_EXPORT TopOpeBRep_EdgesIntersector& ChangeEdgesIntersector();
0087 
0088   //! return the current intersection of a Face and an Edge.
0089   Standard_EXPORT TopOpeBRep_FaceEdgeIntersector& ChangeFaceEdgeIntersector();
0090 
0091   //! return geometric shape <Index> ( = 1 or 2 ) of
0092   //! current intersection.
0093   Standard_EXPORT const TopoDS_Shape& CurrentGeomShape(const int Index) const;
0094 
0095   //! return MAX of intersection tolerances with
0096   //! which FacesIntersector from TopOpeBRep was working.
0097   Standard_EXPORT void GetTolerances(double& tol1, double& tol2) const;
0098 
0099   Standard_EXPORT void DumpCurrent(const int K) const;
0100 
0101   Standard_EXPORT int Index(const int K) const;
0102 
0103   Standard_EXPORT void RejectedFaces(const TopoDS_Shape&             anObj,
0104                                      const TopoDS_Shape&             aReference,
0105                                      NCollection_List<TopoDS_Shape>& aListOfShape);
0106 
0107 private:
0108   Standard_EXPORT void Reset();
0109 
0110   Standard_EXPORT void Init(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0111 
0112   Standard_EXPORT void SetIntersectionDone();
0113 
0114   Standard_EXPORT void InitFFIntersection();
0115 
0116   Standard_EXPORT void FindFFIntersection();
0117 
0118   Standard_EXPORT bool MoreFFCouple() const;
0119 
0120   Standard_EXPORT void NextFFCouple();
0121 
0122   Standard_EXPORT void InitEEFFIntersection();
0123 
0124   Standard_EXPORT void FindEEFFIntersection();
0125 
0126   Standard_EXPORT bool MoreEEFFCouple() const;
0127 
0128   Standard_EXPORT void NextEEFFCouple();
0129 
0130   Standard_EXPORT void InitFEIntersection();
0131 
0132   Standard_EXPORT void FindFEIntersection();
0133 
0134   Standard_EXPORT bool MoreFECouple() const;
0135 
0136   Standard_EXPORT void NextFECouple();
0137 
0138   Standard_EXPORT void InitEFIntersection();
0139 
0140   Standard_EXPORT void FindEFIntersection();
0141 
0142   Standard_EXPORT bool MoreEFCouple() const;
0143 
0144   Standard_EXPORT void NextEFCouple();
0145 
0146   Standard_EXPORT void InitEEIntersection();
0147 
0148   Standard_EXPORT void FindEEIntersection();
0149 
0150   Standard_EXPORT bool MoreEECouple() const;
0151 
0152   Standard_EXPORT void NextEECouple();
0153 
0154   TopoDS_Shape                         myShape1;
0155   TopoDS_Shape                         myShape2;
0156   occ::handle<TopOpeBRepTool_HBoxTool> myHBoxTool;
0157   TopOpeBRepTool_ShapeExplorer         myFaceExplorer;
0158   TopOpeBRep_ShapeScanner              myFaceScanner;
0159   TopOpeBRep_FacesIntersector          myFFIntersector;
0160   bool                                 myFFSameDomain;
0161   TopOpeBRepTool_ShapeExplorer         myEdgeExplorer;
0162   TopOpeBRep_ShapeScanner              myEdgeScanner;
0163   TopOpeBRep_EdgesIntersector          myEEIntersector;
0164   TopOpeBRep_FaceEdgeIntersector       myFEIntersector;
0165   TopoDS_Face                          myEEFace1;
0166   TopoDS_Face                          myEEFace2;
0167   bool                                 myIntersectionDone;
0168   double                               myTol1;
0169   double                               myTol2;
0170   bool                                 myFFDone;
0171   bool                                 myEEFFDone;
0172   bool                                 myEFDone;
0173   bool                                 myFEDone;
0174   bool                                 myEEDone;
0175   bool                                 myFFInit;
0176   bool                                 myEEFFInit;
0177   bool                                 myEFInit;
0178   bool                                 myFEInit;
0179   bool                                 myEEInit;
0180 };
0181 
0182 #endif // _TopOpeBRep_ShapeIntersector_HeaderFile