Back to home page

EIC code displayed by LXR

 
 

    


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

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