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_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 <TopTools_ListOfShape.hxx>
0032 class TopOpeBRepTool_HBoxTool;
0033 
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 
0058   DEFINE_STANDARD_ALLOC
0059 
0060   
0061   Standard_EXPORT TopOpeBRep_ShapeIntersector();
0062   
0063   //! Initialize the intersection of shapes S1,S2.
0064   Standard_EXPORT void InitIntersection (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0065   
0066   //! Initialize the intersection of shapes S1,S2.
0067   Standard_EXPORT void InitIntersection (const TopoDS_Shape& S1, const TopoDS_Shape& S2, const TopoDS_Face& F1, const TopoDS_Face& F2);
0068   
0069   //! return  the shape  <Index> ( = 1 or 2) given to
0070   //! InitIntersection().
0071   //! Index = 1 will return S1, Index = 2 will return S2.
0072   Standard_EXPORT const TopoDS_Shape& Shape (const Standard_Integer Index) const;
0073   
0074   //! returns True if there are more intersection
0075   //! between two the shapes.
0076   Standard_EXPORT Standard_Boolean MoreIntersection() const;
0077   
0078   //! search for the next intersection between the two shapes.
0079   Standard_EXPORT void NextIntersection();
0080   
0081   //! return the current intersection of two Faces.
0082   Standard_EXPORT TopOpeBRep_FacesIntersector& ChangeFacesIntersector();
0083   
0084   //! return the current intersection of two Edges.
0085   Standard_EXPORT TopOpeBRep_EdgesIntersector& ChangeEdgesIntersector();
0086   
0087   //! return the current intersection of a Face and an Edge.
0088   Standard_EXPORT TopOpeBRep_FaceEdgeIntersector& ChangeFaceEdgeIntersector();
0089   
0090   //! return  geometric  shape <Index> ( = 1 or 2 )  of
0091   //! current intersection.
0092   Standard_EXPORT const TopoDS_Shape& CurrentGeomShape (const Standard_Integer Index) const;
0093   
0094   //! return  MAX of intersection tolerances with
0095   //! which FacesIntersector from TopOpeBRep was working.
0096   Standard_EXPORT void GetTolerances (Standard_Real& tol1, Standard_Real& tol2) const;
0097   
0098   Standard_EXPORT void DumpCurrent (const Standard_Integer K) const;
0099   
0100   Standard_EXPORT Standard_Integer Index (const Standard_Integer K) const;
0101   
0102   Standard_EXPORT void RejectedFaces (const TopoDS_Shape& anObj, const TopoDS_Shape& aReference, TopTools_ListOfShape& aListOfShape);
0103 
0104 
0105 
0106 
0107 protected:
0108 
0109 
0110 
0111 
0112 
0113 private:
0114 
0115   
0116   Standard_EXPORT void Reset();
0117   
0118   Standard_EXPORT void Init (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0119   
0120   Standard_EXPORT void SetIntersectionDone();
0121   
0122   Standard_EXPORT void InitFFIntersection();
0123   
0124   Standard_EXPORT void FindFFIntersection();
0125   
0126   Standard_EXPORT Standard_Boolean MoreFFCouple() const;
0127   
0128   Standard_EXPORT void NextFFCouple();
0129   
0130   Standard_EXPORT void InitEEFFIntersection();
0131   
0132   Standard_EXPORT void FindEEFFIntersection();
0133   
0134   Standard_EXPORT Standard_Boolean MoreEEFFCouple() const;
0135   
0136   Standard_EXPORT void NextEEFFCouple();
0137   
0138   Standard_EXPORT void InitFEIntersection();
0139   
0140   Standard_EXPORT void FindFEIntersection();
0141   
0142   Standard_EXPORT Standard_Boolean MoreFECouple() const;
0143   
0144   Standard_EXPORT void NextFECouple();
0145   
0146   Standard_EXPORT void InitEFIntersection();
0147   
0148   Standard_EXPORT void FindEFIntersection();
0149   
0150   Standard_EXPORT Standard_Boolean MoreEFCouple() const;
0151   
0152   Standard_EXPORT void NextEFCouple();
0153   
0154   Standard_EXPORT void InitEEIntersection();
0155   
0156   Standard_EXPORT void FindEEIntersection();
0157   
0158   Standard_EXPORT Standard_Boolean MoreEECouple() const;
0159   
0160   Standard_EXPORT void NextEECouple();
0161 
0162 
0163   TopoDS_Shape myShape1;
0164   TopoDS_Shape myShape2;
0165   Handle(TopOpeBRepTool_HBoxTool) myHBoxTool;
0166   TopOpeBRepTool_ShapeExplorer myFaceExplorer;
0167   TopOpeBRep_ShapeScanner myFaceScanner;
0168   TopOpeBRep_FacesIntersector myFFIntersector;
0169   Standard_Boolean myFFSameDomain;
0170   TopOpeBRepTool_ShapeExplorer myEdgeExplorer;
0171   TopOpeBRep_ShapeScanner myEdgeScanner;
0172   TopOpeBRep_EdgesIntersector myEEIntersector;
0173   TopOpeBRep_FaceEdgeIntersector myFEIntersector;
0174   TopoDS_Face myEEFace1;
0175   TopoDS_Face myEEFace2;
0176   Standard_Boolean myIntersectionDone;
0177   Standard_Real myTol1;
0178   Standard_Real myTol2;
0179   Standard_Boolean myFFDone;
0180   Standard_Boolean myEEFFDone;
0181   Standard_Boolean myEFDone;
0182   Standard_Boolean myFEDone;
0183   Standard_Boolean myEEDone;
0184   Standard_Boolean myFFInit;
0185   Standard_Boolean myEEFFInit;
0186   Standard_Boolean myEFInit;
0187   Standard_Boolean myFEInit;
0188   Standard_Boolean myEEInit;
0189 
0190 
0191 };
0192 
0193 
0194 
0195 
0196 
0197 
0198 
0199 #endif // _TopOpeBRep_ShapeIntersector_HeaderFile