1 // Created on: 1993-05-07 2 // Created by: Jean Yves LEBEY 3 // Copyright (c) 1993-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _TopOpeBRep_ShapeIntersector2d_HeaderFile 18 #define _TopOpeBRep_ShapeIntersector2d_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <TopoDS_Shape.hxx> 25 #include <TopOpeBRepTool_ShapeExplorer.hxx> 26 #include <TopOpeBRep_ShapeScanner.hxx> 27 #include <TopOpeBRep_EdgesIntersector.hxx> 28 #include <Standard_Boolean.hxx> 29 #include <Standard_Integer.hxx> 30 class TopOpeBRepTool_HBoxTool; 31 class TopoDS_Shape; 32 class TopOpeBRep_EdgesIntersector; 33 34 35 //! Intersect two shapes. 36 //! 37 //! A GeomShape is a shape with a geometric domain, i.e. 38 //! a Face or an Edge. 39 //! 40 //! The purpose of the ShapeIntersector2d is to find 41 //! couples of intersecting GeomShape in two Shapes 42 //! (which can be any kind of topologies : Compound, 43 //! Solid, Shell, etc... ) 44 //! 45 //! It is in charge of exploration of the shapes and 46 //! rejection. For this it is provided with two tools : 47 //! 48 //! - ShapeExplorer from TopOpeBRepTool. 49 //! - ShapeScanner from TopOpeBRep which implements bounding boxes. 50 //! 51 //! Let S1,S2 the shapes sent to InitIntersection(S1,S2) method : 52 //! - S1 is always SCANNED by a ShapeScanner from TopOpeBRep. 53 //! - S2 is always EXPLORED by a ShapeExplorer from TopOpeBRepTool. 54 class TopOpeBRep_ShapeIntersector2d 55 { 56 public: 57 58 DEFINE_STANDARD_ALLOC 59 60 61 Standard_EXPORT TopOpeBRep_ShapeIntersector2d(); 62 63 //! Initialize the intersection of shapes S1,S2. 64 Standard_EXPORT void InitIntersection (const TopoDS_Shape& S1, const TopoDS_Shape& S2); 65 66 //! return the shape <Index> ( = 1 or 2) given to 67 //! InitIntersection(). 68 //! Index = 1 will return S1, Index = 2 will return S2. 69 Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer Index) const; 70 71 //! returns True if there are more intersection 72 //! between two the shapes. 73 Standard_EXPORT Standard_Boolean MoreIntersection() const; 74 75 //! search for the next intersection between the two shapes. 76 Standard_EXPORT void NextIntersection(); 77 78 //! return the current intersection of two Edges. 79 Standard_EXPORT TopOpeBRep_EdgesIntersector& ChangeEdgesIntersector(); 80 81 //! return geometric shape <Index> ( = 1 or 2 ) of 82 //! current intersection. 83 Standard_EXPORT const TopoDS_Shape& CurrentGeomShape (const Standard_Integer Index) const; 84 85 Standard_EXPORT void DumpCurrent (const Standard_Integer K) const; 86 87 Standard_EXPORT Standard_Integer Index (const Standard_Integer K) const; 88 89 90 91 92 protected: 93 94 95 96 97 98 private: 99 100 101 Standard_EXPORT void Reset(); 102 103 Standard_EXPORT void Init (const TopoDS_Shape& S1, const TopoDS_Shape& S2); 104 105 Standard_EXPORT void SetIntersectionDone(); 106 107 Standard_EXPORT void InitFFIntersection(); 108 109 Standard_EXPORT void FindFFIntersection(); 110 111 Standard_EXPORT Standard_Boolean MoreFFCouple() const; 112 113 Standard_EXPORT void NextFFCouple(); 114 115 Standard_EXPORT void InitEEFFIntersection(); 116 117 Standard_EXPORT void FindEEFFIntersection(); 118 119 Standard_EXPORT Standard_Boolean MoreEEFFCouple() const; 120 121 Standard_EXPORT void NextEEFFCouple(); 122 123 124 TopoDS_Shape myShape1; 125 TopoDS_Shape myShape2; 126 Handle(TopOpeBRepTool_HBoxTool) myHBoxTool; 127 TopOpeBRepTool_ShapeExplorer myFaceExplorer; 128 TopOpeBRep_ShapeScanner myFaceScanner; 129 TopOpeBRepTool_ShapeExplorer myEdgeExplorer; 130 TopOpeBRep_ShapeScanner myEdgeScanner; 131 TopOpeBRep_EdgesIntersector myEEIntersector; 132 Standard_Boolean myIntersectionDone; 133 Standard_Boolean myFFDone; 134 Standard_Boolean myEEFFDone; 135 Standard_Boolean myFFInit; 136 Standard_Boolean myEEFFInit; 137 138 139 }; 140 141 142 143 144 145 146 147 #endif // _TopOpeBRep_ShapeIntersector2d_HeaderFile 148