42cf5bc1 |
1 | // Created on: 1992-11-19 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1992-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 _BRepClass_FaceExplorer_HeaderFile |
18 | #define _BRepClass_FaceExplorer_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
cb7f9239 |
22 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
42cf5bc1 |
23 | |
cb7f9239 |
24 | #include <TopAbs_Orientation.hxx> |
42cf5bc1 |
25 | #include <TopoDS_Face.hxx> |
26 | #include <TopExp_Explorer.hxx> |
27 | #include <Standard_Integer.hxx> |
42cf5bc1 |
28 | class gp_Pnt2d; |
29 | class gp_Lin2d; |
30 | class BRepClass_Edge; |
31 | |
32 | |
33 | //! Provide an exploration of a BRep Face for the |
34 | //! classification. Return UV edges. |
35 | class BRepClass_FaceExplorer |
36 | { |
37 | public: |
38 | |
39 | DEFINE_STANDARD_ALLOC |
40 | |
41 | |
42 | Standard_EXPORT BRepClass_FaceExplorer(const TopoDS_Face& F); |
a148c938 |
43 | |
44 | //! Checks the point and change its coords if it is located too far |
45 | //! from the bounding box of the face. New Coordinates of the point |
46 | //! will be on the line between the point and the center of the |
47 | //! bounding box. Returns True if point was not changed. |
48 | Standard_EXPORT Standard_Boolean CheckPoint (gp_Pnt2d& thePoint); |
42cf5bc1 |
49 | |
50 | //! Should return True if the point is outside a |
51 | //! bounding volume of the face. |
52 | Standard_EXPORT Standard_Boolean Reject (const gp_Pnt2d& P) const; |
53 | |
54 | //! Returns in <L>, <Par> a segment having at least |
55 | //! one intersection with the face boundary to |
56 | //! compute intersections. |
57 | Standard_EXPORT Standard_Boolean Segment (const gp_Pnt2d& P, gp_Lin2d& L, Standard_Real& Par); |
58 | |
59 | //! Returns in <L>, <Par> a segment having at least |
60 | //! one intersection with the face boundary to |
61 | //! compute intersections. Each call gives another segment. |
62 | Standard_EXPORT Standard_Boolean OtherSegment (const gp_Pnt2d& P, gp_Lin2d& L, Standard_Real& Par); |
63 | |
64 | //! Starts an exploration of the wires. |
65 | Standard_EXPORT void InitWires(); |
66 | |
67 | //! Returns True if there is a current wire. |
68 | Standard_Boolean MoreWires() const; |
69 | |
70 | //! Sets the explorer to the next wire. |
71 | void NextWire(); |
72 | |
73 | //! Returns True if the wire bounding volume does not |
74 | //! intersect the segment. |
75 | Standard_EXPORT Standard_Boolean RejectWire (const gp_Lin2d& L, const Standard_Real Par) const; |
76 | |
77 | //! Starts an exploration of the edges of the current |
78 | //! wire. |
79 | Standard_EXPORT void InitEdges(); |
80 | |
81 | //! Returns True if there is a current edge. |
82 | Standard_Boolean MoreEdges() const; |
83 | |
84 | //! Sets the explorer to the next edge. |
85 | void NextEdge(); |
86 | |
87 | //! Returns True if the edge bounding volume does not |
88 | //! intersect the segment. |
89 | Standard_EXPORT Standard_Boolean RejectEdge (const gp_Lin2d& L, const Standard_Real Par) const; |
90 | |
91 | //! Current edge in current wire and its orientation. |
92 | Standard_EXPORT void CurrentEdge (BRepClass_Edge& E, TopAbs_Orientation& Or) const; |
93 | |
715fcb5a |
94 | //! Returns the maximum tolerance |
95 | Standard_Real MaxTolerance() const |
96 | { |
97 | return myMaxTolerance; |
98 | } |
99 | |
100 | //! Sets the maximum tolerance at |
101 | //! which to start checking in the intersector |
102 | void SetMaxTolerance(const Standard_Real theValue) |
103 | { |
104 | myMaxTolerance = theValue; |
105 | } |
106 | |
107 | //! Returns true if we are using boxes |
108 | //! in the intersector |
109 | Standard_Boolean UseBndBox() const |
110 | { |
111 | return myUseBndBox; |
112 | } |
113 | |
114 | //! Sets the status of whether we are |
115 | //! using boxes or not |
116 | void SetUseBndBox(const Standard_Boolean theValue) |
117 | { |
118 | myUseBndBox = theValue; |
119 | } |
120 | |
42cf5bc1 |
121 | |
122 | |
123 | |
124 | protected: |
125 | |
47cd8af2 |
126 | //! Computes UV bounds of a face |
127 | Standard_EXPORT void ComputeFaceBounds(); |
42cf5bc1 |
128 | |
129 | |
130 | private: |
131 | |
132 | |
133 | |
134 | TopoDS_Face myFace; |
135 | TopExp_Explorer myWExplorer; |
136 | TopExp_Explorer myEExplorer; |
137 | Standard_Integer myCurEdgeInd; |
138 | Standard_Real myCurEdgePar; |
715fcb5a |
139 | Standard_Real myMaxTolerance; |
140 | Standard_Boolean myUseBndBox; |
cb7f9239 |
141 | TopTools_IndexedDataMapOfShapeListOfShape myMapVE; |
42cf5bc1 |
142 | |
47cd8af2 |
143 | Standard_Real myUMin; |
144 | Standard_Real myUMax; |
145 | Standard_Real myVMin; |
146 | Standard_Real myVMax; |
42cf5bc1 |
147 | }; |
148 | |
149 | |
150 | #include <BRepClass_FaceExplorer.lxx> |
151 | |
152 | |
153 | |
154 | |
155 | |
156 | #endif // _BRepClass_FaceExplorer_HeaderFile |