42cf5bc1 |
1 | // Created on: 1994-03-10 |
2 | // Created by: Laurent BUCHARD |
3 | // Copyright (c) 1994-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 _BRepClass3d_SolidExplorer_HeaderFile |
18 | #define _BRepClass3d_SolidExplorer_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <Bnd_Box.hxx> |
c22b52d6 |
21 | #include <BRepAdaptor_Surface.hxx> |
22 | #include <BRepClass3d_BndBoxTree.hxx> |
42cf5bc1 |
23 | #include <BRepClass3d_MapOfInter.hxx> |
24 | #include <TopAbs_State.hxx> |
c22b52d6 |
25 | #include <TopExp_Explorer.hxx> |
26 | #include <TopoDS_Shape.hxx> |
58e14d59 |
27 | #include <TopTools_IndexedMapOfShape.hxx> |
28 | |
42cf5bc1 |
29 | class gp_Pnt; |
30 | class TopoDS_Face; |
31 | class gp_Vec; |
42cf5bc1 |
32 | class TopoDS_Shell; |
33 | class gp_Lin; |
42cf5bc1 |
34 | class IntCurvesFace_Intersector; |
35 | |
58e14d59 |
36 | //! Provide an exploration of a BRep Shape for the classification. |
37 | //! Provide access to the special UB tree to obtain fast search. |
42cf5bc1 |
38 | class BRepClass3d_SolidExplorer |
39 | { |
40 | public: |
41 | |
42 | DEFINE_STANDARD_ALLOC |
43 | |
44 | |
45 | Standard_EXPORT BRepClass3d_SolidExplorer(); |
46 | |
42cf5bc1 |
47 | Standard_EXPORT BRepClass3d_SolidExplorer(const TopoDS_Shape& S); |
48 | |
e6f550da |
49 | Standard_EXPORT virtual ~BRepClass3d_SolidExplorer(); |
42cf5bc1 |
50 | |
51 | Standard_EXPORT void InitShape (const TopoDS_Shape& S); |
52 | |
53 | //! Should return True if P outside of bounding vol. of the shape |
54 | Standard_EXPORT virtual Standard_Boolean Reject (const gp_Pnt& P) const; |
55 | |
56 | //! compute a point P in the face F. Param is a Real in |
57 | //! ]0,1[ and is used to initialise the algorithm. For |
58 | //! different values , different points are returned. |
59 | Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& Param); |
60 | |
61 | Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v, Standard_Real& Param); |
62 | |
63 | 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); |
64 | |
65 | Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P, Standard_Real& u, Standard_Real& v); |
66 | |
67 | Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, gp_Pnt& P); |
68 | |
69 | Standard_EXPORT static Standard_Boolean FindAPointInTheFace (const TopoDS_Face& F, Standard_Real& u, Standard_Real& v); |
70 | |
71 | 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; |
72 | |
c22b52d6 |
73 | 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; |
42cf5bc1 |
74 | |
75 | //! <Index> gives point index to search from and returns |
76 | //! point index of succeseful search |
c22b52d6 |
77 | 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; |
42cf5bc1 |
78 | |
79 | //! Starts an exploration of the shells. |
80 | Standard_EXPORT void InitShell(); |
81 | |
82 | //! Returns True if there is a current shell. |
83 | Standard_EXPORT Standard_Boolean MoreShell() const; |
84 | |
85 | //! Sets the explorer to the next shell. |
86 | Standard_EXPORT void NextShell(); |
87 | |
88 | //! Returns the current shell. |
89 | Standard_EXPORT TopoDS_Shell CurrentShell() const; |
90 | |
91 | //! Returns True if the Shell is rejected. |
92 | Standard_EXPORT virtual Standard_Boolean RejectShell (const gp_Lin& L) const; |
93 | |
94 | //! Starts an exploration of the faces of the current shell. |
95 | Standard_EXPORT void InitFace(); |
96 | |
97 | //! Returns True if current face in current shell. |
98 | Standard_EXPORT Standard_Boolean MoreFace() const; |
99 | |
100 | //! Sets the explorer to the next Face of the current shell. |
101 | Standard_EXPORT void NextFace(); |
102 | |
103 | //! Returns the current face. |
104 | Standard_EXPORT TopoDS_Face CurrentFace() const; |
105 | |
106 | //! returns True if the face is rejected. |
107 | Standard_EXPORT virtual Standard_Boolean RejectFace (const gp_Lin& L) const; |
108 | |
109 | //! Returns in <L>, <Par> a segment having at least |
110 | //! one intersection with the shape boundary to |
111 | //! compute intersections. |
112 | Standard_EXPORT Standard_Integer Segment (const gp_Pnt& P, gp_Lin& L, Standard_Real& Par); |
113 | |
114 | //! Returns in <L>, <Par> a segment having at least |
115 | //! one intersection with the shape boundary to |
116 | //! compute intersections. |
117 | //! |
118 | //! The First Call to this method returns a line which |
119 | //! point to a point of the first face of the shape. |
120 | //! The Second Call provide a line to the second face |
121 | //! and so on. |
122 | Standard_EXPORT Standard_Integer OtherSegment (const gp_Pnt& P, gp_Lin& L, Standard_Real& Par); |
123 | |
124 | //! Returns the index of face for which |
125 | //! last segment is calculated. |
126 | Standard_EXPORT Standard_Integer GetFaceSegmentIndex() const; |
127 | |
128 | Standard_EXPORT virtual void DumpSegment (const gp_Pnt& P, const gp_Lin& L, const Standard_Real Par, const TopAbs_State S) const; |
129 | |
130 | Standard_EXPORT const Bnd_Box& Box() const; |
58e14d59 |
131 | |
132 | Standard_EXPORT const TopoDS_Shape& GetShape() const; |
42cf5bc1 |
133 | |
134 | Standard_EXPORT IntCurvesFace_Intersector& Intersector (const TopoDS_Face& F) const; |
58e14d59 |
135 | |
136 | //! Return UB-tree instance which is used for edge / vertex checks. |
137 | const BRepClass3d_BndBoxTree& GetTree () {return myTree;} |
138 | //! Return edge/vertices map for current shape. |
139 | const TopTools_IndexedMapOfShape& GetMapEV () {return myMapEV;} |
42cf5bc1 |
140 | |
141 | Standard_EXPORT void Destroy(); |
142 | |
9775fa61 |
143 | private: |
144 | |
145 | Standard_EXPORT BRepClass3d_SolidExplorer(const BRepClass3d_SolidExplorer& Oth); |
146 | |
42cf5bc1 |
147 | protected: |
148 | |
c58b3078 |
149 | Standard_EXPORT TopAbs_State ClassifyUVPoint |
150 | (const IntCurvesFace_Intersector& theIntersector, |
c22b52d6 |
151 | const Handle(BRepAdaptor_Surface)& theSurf, |
c58b3078 |
152 | const gp_Pnt2d& theP2d) const; |
42cf5bc1 |
153 | |
154 | private: |
155 | |
156 | |
157 | |
158 | Bnd_Box myBox; |
159 | TopoDS_Shape myShape; |
160 | Standard_Boolean myReject; |
161 | Standard_Integer myFirstFace; |
162 | Standard_Real myParamOnEdge; |
163 | TopExp_Explorer myShellExplorer; |
164 | TopExp_Explorer myFaceExplorer; |
165 | BRepClass3d_MapOfInter myMapOfInter; |
58e14d59 |
166 | BRepClass3d_BndBoxTree myTree; |
167 | TopTools_IndexedMapOfShape myMapEV; |
42cf5bc1 |
168 | |
169 | |
170 | }; |
171 | |
172 | |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | #endif // _BRepClass3d_SolidExplorer_HeaderFile |