Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:19:31

0001 // Created on: 1992-11-19
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1992-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 _BRepClass_FaceExplorer_HeaderFile
0018 #define _BRepClass_FaceExplorer_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <TopoDS_Shape.hxx>
0023 #include <NCollection_List.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_IndexedDataMap.hxx>
0026 
0027 #include <TopAbs_Orientation.hxx>
0028 #include <TopoDS_Face.hxx>
0029 #include <TopExp_Explorer.hxx>
0030 #include <Standard_Integer.hxx>
0031 class gp_Pnt2d;
0032 class gp_Lin2d;
0033 class BRepClass_Edge;
0034 
0035 //! Provide an exploration of a BRep Face for the
0036 //! classification. Return UV edges.
0037 class BRepClass_FaceExplorer
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   Standard_EXPORT BRepClass_FaceExplorer(const TopoDS_Face& F);
0043 
0044   //! Checks the point and change its coords if it is located too far
0045   //! from the bounding box of the face. New Coordinates of the point
0046   //! will be on the line between the point and the center of the
0047   //! bounding box. Returns True if point was not changed.
0048   Standard_EXPORT bool CheckPoint(gp_Pnt2d& thePoint);
0049 
0050   //! Should return True if the point is outside a
0051   //! bounding volume of the face.
0052   Standard_EXPORT bool Reject(const gp_Pnt2d& P) const;
0053 
0054   //! Returns in <L>, <Par> a segment having at least
0055   //! one intersection with the face boundary to
0056   //! compute intersections.
0057   Standard_EXPORT bool Segment(const gp_Pnt2d& P, gp_Lin2d& L, double& Par);
0058 
0059   //! Returns in <L>, <Par> a segment having at least
0060   //! one intersection with the face boundary to
0061   //! compute intersections. Each call gives another segment.
0062   Standard_EXPORT bool OtherSegment(const gp_Pnt2d& P, gp_Lin2d& L, double& Par);
0063 
0064   //! Starts an exploration of the wires.
0065   Standard_EXPORT void InitWires();
0066 
0067   //! Returns True if there is a current wire.
0068   bool MoreWires() const { return myWExplorer.More(); }
0069 
0070   //! Sets the explorer to the next wire.
0071   void NextWire() { myWExplorer.Next(); }
0072 
0073   //! Returns True if the wire bounding volume does not
0074   //! intersect the segment.
0075   Standard_EXPORT bool RejectWire(const gp_Lin2d& L, const double Par) const;
0076 
0077   //! Starts an exploration of the edges of the current
0078   //! wire.
0079   Standard_EXPORT void InitEdges();
0080 
0081   //! Returns True if there is a current edge.
0082   bool MoreEdges() const { return myEExplorer.More(); }
0083 
0084   //! Sets the explorer to the next edge.
0085   void NextEdge() { myEExplorer.Next(); }
0086 
0087   //! Returns True if the edge bounding volume does not
0088   //! intersect the segment.
0089   Standard_EXPORT bool RejectEdge(const gp_Lin2d& L, const double Par) const;
0090 
0091   //! Current edge in current wire and its orientation.
0092   Standard_EXPORT void CurrentEdge(BRepClass_Edge& E, TopAbs_Orientation& Or) const;
0093 
0094   //! Returns the maximum tolerance
0095   double MaxTolerance() const { return myMaxTolerance; }
0096 
0097   //! Sets the maximum tolerance at
0098   //! which to start checking in the intersector
0099   void SetMaxTolerance(const double theValue) { myMaxTolerance = theValue; }
0100 
0101   //! Returns true if we are using boxes
0102   //! in the intersector
0103   bool UseBndBox() const { return myUseBndBox; }
0104 
0105   //! Sets the status of whether we are
0106   //! using boxes or not
0107   void SetUseBndBox(const bool theValue) { myUseBndBox = theValue; }
0108 
0109 protected:
0110   //! Computes UV bounds of a face
0111   Standard_EXPORT void ComputeFaceBounds();
0112 
0113 private:
0114   TopoDS_Face     myFace;
0115   TopExp_Explorer myWExplorer;
0116   TopExp_Explorer myEExplorer;
0117   int             myCurEdgeInd;
0118   double          myCurEdgePar;
0119   double          myMaxTolerance;
0120   bool            myUseBndBox;
0121   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0122     myMapVE;
0123 
0124   double myUMin;
0125   double myUMax;
0126   double myVMin;
0127   double myVMax;
0128 };
0129 
0130 #endif // _BRepClass_FaceExplorer_HeaderFile