Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:10

0001 // Created on: 1994-03-10
0002 // Created by: Laurent BUCHARD
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 _BRepClass3d_SolidExplorer_HeaderFile
0018 #define _BRepClass3d_SolidExplorer_HeaderFile
0019 
0020 #include <Bnd_Box.hxx>
0021 #include <BRepAdaptor_Surface.hxx>
0022 #include <BRepClass3d_BndBoxTree.hxx>
0023 #include <BRepClass3d_MapOfInter.hxx>
0024 #include <TopAbs_State.hxx>
0025 #include <TopExp_Explorer.hxx>
0026 #include <TopoDS_Shape.hxx>
0027 #include <TopTools_IndexedMapOfShape.hxx>
0028 
0029 class gp_Pnt;
0030 class TopoDS_Face;
0031 class gp_Vec;
0032 class TopoDS_Shell;
0033 class gp_Lin;
0034 class IntCurvesFace_Intersector;
0035 
0036 //! Provide an exploration of a BRep Shape for the classification.
0037 //! Provide access to the special UB tree to obtain fast search.
0038 class BRepClass3d_SolidExplorer 
0039 {
0040 public:
0041 
0042   DEFINE_STANDARD_ALLOC
0043 
0044   
0045   Standard_EXPORT BRepClass3d_SolidExplorer();
0046   
0047   Standard_EXPORT BRepClass3d_SolidExplorer(const TopoDS_Shape& S);
0048   
0049   Standard_EXPORT virtual ~BRepClass3d_SolidExplorer();
0050   
0051   Standard_EXPORT void InitShape (const TopoDS_Shape& S);
0052   
0053   //! Should return True if P outside of bounding vol. of the shape
0054   Standard_EXPORT virtual Standard_Boolean Reject (const gp_Pnt& P) const;
0055   
0056   //! compute a point P in the face  F. Param is a Real in
0057   //! ]0,1[ and   is  used to  initialise  the algorithm. For
0058   //! different values , different points are returned.
0059   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& Param);
0060   
0061   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param);
0062   
0063   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param, gp_Vec& theVecD1U, gp_Vec& theVecD1V);
0064   
0065   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v);
0066   
0067   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P);
0068   
0069   Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, Standard_Real& u, Standard_Real& v);
0070   
0071   Standard_EXPORT Standard_Boolean PointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param, Standard_Integer& Index) const;
0072   
0073   Standard_EXPORT Standard_Boolean PointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param, Standard_Integer& Index, const Handle(BRepAdaptor_Surface)& surf, const Standard_Real u1, const Standard_Real v1, const Standard_Real u2, const Standard_Real v2) const;
0074   
0075   //! <Index> gives point index  to  search from and returns
0076   //! point index of succeseful search
0077   Standard_EXPORT Standard_Boolean PointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param, Standard_Integer& Index, const Handle(BRepAdaptor_Surface)& surf, const Standard_Real u1, const Standard_Real v1, const Standard_Real u2, const Standard_Real v2, gp_Vec& theVecD1U, gp_Vec& theVecD1V) const;
0078   
0079   //! Starts an exploration of the shells.
0080   Standard_EXPORT void InitShell();
0081   
0082   //! Returns True if there is a current shell.
0083   Standard_EXPORT Standard_Boolean MoreShell() const;
0084   
0085   //! Sets the explorer to the next shell.
0086   Standard_EXPORT void NextShell();
0087   
0088   //! Returns the current shell.
0089   Standard_EXPORT TopoDS_Shell CurrentShell() const;
0090   
0091   //! Returns True if the Shell is rejected.
0092   Standard_EXPORT virtual Standard_Boolean RejectShell (const gp_Lin& L) const;
0093   
0094   //! Starts an exploration of the faces of the current shell.
0095   Standard_EXPORT void InitFace();
0096   
0097   //! Returns True if current face in current shell.
0098   Standard_EXPORT Standard_Boolean MoreFace() const;
0099   
0100   //! Sets the explorer to the next Face of the current shell.
0101   Standard_EXPORT void NextFace();
0102   
0103   //! Returns the current face.
0104   Standard_EXPORT TopoDS_Face CurrentFace() const;
0105   
0106   //! returns True if the face is rejected.
0107   Standard_EXPORT virtual Standard_Boolean RejectFace (const gp_Lin& L) const;
0108   
0109   //! Returns  in <L>, <Par>  a segment having at least
0110   //! one  intersection  with  the  shape  boundary  to
0111   //! compute  intersections.
0112   Standard_EXPORT Standard_Integer Segment (const gp_Pnt& P, gp_Lin& L, Standard_Real& Par);
0113   
0114   //! Returns  in <L>, <Par>  a segment having at least
0115   //! one  intersection  with  the  shape  boundary  to
0116   //! compute  intersections.
0117   //!
0118   //! The First Call to this method returns a line which
0119   //! point to a point of the first face of the shape.
0120   //! The Second Call provide a line to the second face
0121   //! and so on.
0122   Standard_EXPORT Standard_Integer OtherSegment (const gp_Pnt& P, gp_Lin& L, Standard_Real& Par);
0123   
0124   //! Returns the index of face for which
0125   //! last segment is calculated.
0126   Standard_EXPORT Standard_Integer GetFaceSegmentIndex() const;
0127   
0128   Standard_EXPORT virtual void DumpSegment (const gp_Pnt& P, const gp_Lin& L, const Standard_Real Par, const TopAbs_State S) const;
0129   
0130   Standard_EXPORT const Bnd_Box& Box() const;
0131 
0132   Standard_EXPORT const TopoDS_Shape& GetShape() const;
0133   
0134   Standard_EXPORT IntCurvesFace_Intersector& Intersector (const TopoDS_Face& F) const;
0135 
0136   //! Return UB-tree instance which is used for edge / vertex checks.
0137   const BRepClass3d_BndBoxTree& GetTree () {return myTree;}
0138   //! Return edge/vertices map for current shape.
0139   const TopTools_IndexedMapOfShape& GetMapEV () {return myMapEV;}
0140   
0141   Standard_EXPORT void Destroy();
0142 
0143 private:
0144 
0145   Standard_EXPORT BRepClass3d_SolidExplorer(const BRepClass3d_SolidExplorer& Oth);
0146 
0147 protected:
0148 
0149   Standard_EXPORT TopAbs_State ClassifyUVPoint
0150                    (const IntCurvesFace_Intersector& theIntersector,
0151                     const Handle(BRepAdaptor_Surface)& theSurf,
0152                     const gp_Pnt2d& theP2d) const;
0153 
0154 private:
0155 
0156 
0157 
0158   Bnd_Box myBox;
0159   TopoDS_Shape myShape;
0160   Standard_Boolean myReject;
0161   Standard_Integer myFirstFace;
0162   Standard_Real myParamOnEdge;
0163   TopExp_Explorer myShellExplorer;
0164   TopExp_Explorer myFaceExplorer;
0165   BRepClass3d_MapOfInter myMapOfInter;
0166   BRepClass3d_BndBoxTree myTree;
0167   TopTools_IndexedMapOfShape myMapEV;
0168 
0169 
0170 };
0171 
0172 
0173 
0174 
0175 
0176 
0177 
0178 #endif // _BRepClass3d_SolidExplorer_HeaderFile