Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1994-10-11
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1994-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_FacesIntersector_HeaderFile
0018 #define _TopOpeBRep_FacesIntersector_HeaderFile
0019 
0020 #include <BRepAdaptor_Surface.hxx>
0021 #include <GeomAbs_SurfaceType.hxx>
0022 #include <IntPatch_Intersection.hxx>
0023 #include <TopAbs_ShapeEnum.hxx>
0024 #include <TopOpeBRep_HArray1OfLineInter.hxx>
0025 #include <TopoDS_Face.hxx>
0026 #include <TopTools_IndexedMapOfShape.hxx>
0027 
0028 class BRepTopAdaptor_TopolTool;
0029 class Bnd_Box;
0030 
0031 //! Describes the intersection of two faces.
0032 class TopOpeBRep_FacesIntersector 
0033 {
0034 public:
0035 
0036   DEFINE_STANDARD_ALLOC
0037 
0038   
0039   Standard_EXPORT TopOpeBRep_FacesIntersector();
0040   
0041   //! Computes the intersection of faces S1 and S2.
0042   Standard_EXPORT void Perform (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0043   
0044   //! Computes the intersection of faces S1 and S2.
0045   Standard_EXPORT void Perform (const TopoDS_Shape& S1, const TopoDS_Shape& S2, const Bnd_Box& B1, const Bnd_Box& B2);
0046   
0047   Standard_EXPORT Standard_Boolean IsEmpty();
0048   
0049   Standard_EXPORT Standard_Boolean IsDone() const;
0050   
0051   //! Returns True if Perform() arguments are two faces with the
0052   //! same surface.
0053   Standard_EXPORT Standard_Boolean SameDomain() const;
0054   
0055   //! returns first or second intersected face.
0056   Standard_EXPORT const TopoDS_Shape& Face (const Standard_Integer Index) const;
0057   
0058   //! Returns True if Perform() arguments are two faces
0059   //! SameDomain() and normals on both side.
0060   //! Raise if SameDomain is False
0061   Standard_EXPORT Standard_Boolean SurfacesSameOriented() const;
0062   
0063   //! returns true if edge <E> is found as same as the edge
0064   //! associated with a RESTRICTION line.
0065   Standard_EXPORT Standard_Boolean IsRestriction (const TopoDS_Shape& E) const;
0066   
0067   //! returns the map of edges found as TopeBRepBRep_RESTRICTION
0068   Standard_EXPORT const TopTools_IndexedMapOfShape& Restrictions() const;
0069   
0070   Standard_EXPORT void PrepareLines();
0071   
0072   Standard_EXPORT Handle(TopOpeBRep_HArray1OfLineInter) Lines();
0073   
0074   Standard_EXPORT Standard_Integer NbLines() const;
0075   
0076   Standard_EXPORT void InitLine();
0077   
0078   Standard_EXPORT Standard_Boolean MoreLine() const;
0079   
0080   Standard_EXPORT void NextLine();
0081   
0082   Standard_EXPORT TopOpeBRep_LineInter& CurrentLine();
0083   
0084   Standard_EXPORT Standard_Integer CurrentLineIndex() const;
0085   
0086   Standard_EXPORT TopOpeBRep_LineInter& ChangeLine (const Standard_Integer IL);
0087   
0088 
0089   //! Force the tolerance values used by the next Perform(S1,S2) call.
0090   Standard_EXPORT void ForceTolerances (const Standard_Real tolarc, const Standard_Real toltang);
0091   
0092 
0093   //! Return the tolerance values used in the last Perform() call
0094   //! If ForceTolerances() has been called, return the given values.
0095   //! If not, return values extracted from shapes.
0096   Standard_EXPORT void GetTolerances (Standard_Real& tolarc, Standard_Real& toltang) const;
0097 
0098 
0099 
0100 
0101 protected:
0102 
0103 
0104 
0105 
0106 
0107 private:
0108 
0109   
0110   Standard_EXPORT void FindLine();
0111   
0112   Standard_EXPORT void ResetIntersection();
0113   
0114   //! extract tolerance values from shapes <S1>,<S2>,
0115   //! in order to perform intersection between <S1> and <S2>
0116   //! with tolerance values "fitting" the shape tolerances.
0117   //! (called by Perform() by default, when ForceTolerances() has not
0118   //! been called)
0119   Standard_EXPORT void ShapeTolerances (const TopoDS_Shape& S1, const TopoDS_Shape& S2);
0120   
0121   //! returns the max tolerance of sub-shapes of type <T>
0122   //! found in shape <S>. If no such sub-shape found, return
0123   //! Precision::Intersection()
0124   //! (called by ShapeTolerances())
0125   Standard_EXPORT Standard_Real ToleranceMax (const TopoDS_Shape& S, const TopAbs_ShapeEnum T) const;
0126 
0127 
0128   IntPatch_Intersection myIntersector;
0129   Standard_Boolean myIntersectionDone;
0130   Standard_Real myTol1;
0131   Standard_Real myTol2;
0132   Standard_Boolean myForceTolerances;
0133   Handle(TopOpeBRep_HArray1OfLineInter) myHAL;
0134   TopOpeBRep_LineInter myLine;
0135   Standard_Integer myLineIndex;
0136   Standard_Boolean myLineFound;
0137   Standard_Integer myLineNb;
0138   TopoDS_Face myFace1;
0139   TopoDS_Face myFace2;
0140   Handle(BRepAdaptor_Surface) mySurface1;
0141   Handle(BRepAdaptor_Surface) mySurface2;
0142   GeomAbs_SurfaceType mySurfaceType1;
0143   GeomAbs_SurfaceType mySurfaceType2;
0144   Standard_Boolean mySurfacesSameOriented;
0145   Handle(BRepTopAdaptor_TopolTool) myDomain1;
0146   Handle(BRepTopAdaptor_TopolTool) myDomain2;
0147   TopTools_IndexedMapOfShape myEdgeRestrictionMap;
0148   TopoDS_Shape myNullShape;
0149 
0150 
0151 };
0152 
0153 
0154 
0155 
0156 
0157 
0158 
0159 #endif // _TopOpeBRep_FacesIntersector_HeaderFile