Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:22:00

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_ShapeIntersector2d_HeaderFile
0018 #define _TopOpeBRep_ShapeIntersector2d_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TopoDS_Shape.hxx>
0025 #include <TopOpeBRepTool_ShapeExplorer.hxx>
0026 #include <TopOpeBRep_ShapeScanner.hxx>
0027 #include <TopOpeBRep_EdgesIntersector.hxx>
0028 #include <Standard_Boolean.hxx>
0029 #include <Standard_Integer.hxx>
0030 class TopOpeBRepTool_HBoxTool;
0031 
0032 //! Intersect two shapes.
0033 //!
0034 //! A GeomShape is a shape with a geometric domain, i.e.
0035 //! a Face or an Edge.
0036 //!
0037 //! The purpose of the ShapeIntersector2d is to find
0038 //! couples of intersecting GeomShape in two Shapes
0039 //! (which can be any kind of topologies: Compound,
0040 //! Solid, Shell, etc... )
0041 //!
0042 //! It is in charge of exploration of the shapes and
0043 //! rejection. For this it is provided with two tools:
0044 //!
0045 //! - ShapeExplorer from TopOpeBRepTool.
0046 //! - ShapeScanner from TopOpeBRep which implements bounding boxes.
0047 //!
0048 //! Let S1,S2 the shapes sent to InitIntersection(S1,S2) method:
0049 //! - S1 is always SCANNED by a ShapeScanner from TopOpeBRep.
0050 //! - S2 is always EXPLORED by a ShapeExplorer from TopOpeBRepTool.
0051 class TopOpeBRep_ShapeIntersector2d
0052 {
0053 public:
0054   DEFINE_STANDARD_ALLOC
0055 
0056   Standard_EXPORT TopOpeBRep_ShapeIntersector2d();
0057 
0058   //! Initialize the intersection of shapes S1,S2.
0059   Standard_EXPORT void InitIntersection(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0060 
0061   //! return the shape <Index> ( = 1 or 2) given to
0062   //! InitIntersection().
0063   //! Index = 1 will return S1, Index = 2 will return S2.
0064   Standard_EXPORT const TopoDS_Shape& Shape(const int Index) const;
0065 
0066   //! returns True if there are more intersection
0067   //! between two the shapes.
0068   Standard_EXPORT bool MoreIntersection() const;
0069 
0070   //! search for the next intersection between the two shapes.
0071   Standard_EXPORT void NextIntersection();
0072 
0073   //! return the current intersection of two Edges.
0074   Standard_EXPORT TopOpeBRep_EdgesIntersector& ChangeEdgesIntersector();
0075 
0076   //! return geometric shape <Index> ( = 1 or 2 ) of
0077   //! current intersection.
0078   Standard_EXPORT const TopoDS_Shape& CurrentGeomShape(const int Index) const;
0079 
0080   Standard_EXPORT void DumpCurrent(const int K) const;
0081 
0082   Standard_EXPORT int Index(const int K) const;
0083 
0084 private:
0085   Standard_EXPORT void Reset();
0086 
0087   Standard_EXPORT void Init(const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0088 
0089   Standard_EXPORT void SetIntersectionDone();
0090 
0091   Standard_EXPORT void InitFFIntersection();
0092 
0093   Standard_EXPORT void FindFFIntersection();
0094 
0095   Standard_EXPORT bool MoreFFCouple() const;
0096 
0097   Standard_EXPORT void NextFFCouple();
0098 
0099   Standard_EXPORT void InitEEFFIntersection();
0100 
0101   Standard_EXPORT void FindEEFFIntersection();
0102 
0103   Standard_EXPORT bool MoreEEFFCouple() const;
0104 
0105   Standard_EXPORT void NextEEFFCouple();
0106 
0107   TopoDS_Shape                         myShape1;
0108   TopoDS_Shape                         myShape2;
0109   occ::handle<TopOpeBRepTool_HBoxTool> myHBoxTool;
0110   TopOpeBRepTool_ShapeExplorer         myFaceExplorer;
0111   TopOpeBRep_ShapeScanner              myFaceScanner;
0112   TopOpeBRepTool_ShapeExplorer         myEdgeExplorer;
0113   TopOpeBRep_ShapeScanner              myEdgeScanner;
0114   TopOpeBRep_EdgesIntersector          myEEIntersector;
0115   bool                                 myIntersectionDone;
0116   bool                                 myFFDone;
0117   bool                                 myEEFFDone;
0118   bool                                 myFFInit;
0119   bool                                 myEEFFInit;
0120 };
0121 
0122 #endif // _TopOpeBRep_ShapeIntersector2d_HeaderFile