42cf5bc1 |
1 | // Created on: 1993-07-07 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1993-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 _BRep_Tool_HeaderFile |
18 | #define _BRep_Tool_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
42cf5bc1 |
24 | #include <GeomAbs_Shape.hxx> |
d1a67b9d |
25 | #include <Geom_Surface.hxx> |
26 | #include <Geom_Curve.hxx> |
27 | #include <Geom2d_Curve.hxx> |
28 | #include <gp_Pnt2d.hxx> |
29 | #include <gp_Pnt.hxx> |
30 | #include <Poly_Triangulation.hxx> |
31 | #include <Poly_Polygon3D.hxx> |
32 | #include <Poly_Polygon2D.hxx> |
33 | #include <Poly_PolygonOnTriangulation.hxx> |
34 | |
42cf5bc1 |
35 | class TopoDS_Shape; |
42cf5bc1 |
36 | class TopoDS_Face; |
37 | class TopLoc_Location; |
42cf5bc1 |
38 | class TopoDS_Edge; |
42cf5bc1 |
39 | class TopoDS_Vertex; |
40 | |
41 | |
42 | //! Provides class methods to access to the geometry |
43 | //! of BRep shapes. |
44 | class BRep_Tool |
45 | { |
46 | public: |
47 | |
48 | DEFINE_STANDARD_ALLOC |
49 | |
50 | |
51 | //! If S is Shell, returns True if it has no free boundaries (edges). |
52 | //! If S is Wire, returns True if it has no free ends (vertices). |
53 | //! (Internal and External sub-shepes are ignored in these checks) |
54 | //! If S is Edge, returns True if its vertices are the same. |
55 | //! For other shape types returns S.Closed(). |
56 | Standard_EXPORT static Standard_Boolean IsClosed (const TopoDS_Shape& S); |
57 | |
58 | //! Returns the geometric surface of the face. Returns |
59 | //! in <L> the location for the surface. |
60 | Standard_EXPORT static const Handle(Geom_Surface)& Surface (const TopoDS_Face& F, TopLoc_Location& L); |
61 | |
62 | //! Returns the geometric surface of the face. It can |
63 | //! be a copy if there is a Location. |
64 | Standard_EXPORT static Handle(Geom_Surface) Surface (const TopoDS_Face& F); |
65 | |
66 | //! Returns the Triangulation of the face. It is a |
67 | //! null handle if there is no triangulation. |
68 | Standard_EXPORT static const Handle(Poly_Triangulation)& Triangulation (const TopoDS_Face& F, TopLoc_Location& L); |
69 | |
70 | //! Returns the tolerance of the face. |
71 | Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Face& F); |
72 | |
73 | //! Returns the NaturalRestriction flag of the face. |
74 | Standard_EXPORT static Standard_Boolean NaturalRestriction (const TopoDS_Face& F); |
75 | |
76 | //! Returns True if <E> is a 3d curve or a curve on |
77 | //! surface. |
78 | Standard_EXPORT static Standard_Boolean IsGeometric (const TopoDS_Edge& E); |
79 | |
80 | //! Returns the 3D curve of the edge. May be a Null |
81 | //! handle. Returns in <L> the location for the curve. |
82 | //! In <First> and <Last> the parameter range. |
83 | Standard_EXPORT static const Handle(Geom_Curve)& Curve (const TopoDS_Edge& E, TopLoc_Location& L, Standard_Real& First, Standard_Real& Last); |
84 | |
85 | //! Returns the 3D curve of the edge. May be a Null handle. |
86 | //! In <First> and <Last> the parameter range. |
87 | //! It can be a copy if there is a Location. |
88 | Standard_EXPORT static Handle(Geom_Curve) Curve (const TopoDS_Edge& E, Standard_Real& First, Standard_Real& Last); |
89 | |
90 | //! Returns the 3D polygon of the edge. May be a Null |
91 | //! handle. Returns in <L> the location for the polygon. |
92 | Standard_EXPORT static const Handle(Poly_Polygon3D)& Polygon3D (const TopoDS_Edge& E, TopLoc_Location& L); |
93 | |
94 | //! Returns the curve associated to the edge in the |
95 | //! parametric space of the face. Returns a NULL |
96 | //! handle if this curve does not exist. Returns in |
97 | //! <First> and <Last> the parameter range. |
98 | Standard_EXPORT static Handle(Geom2d_Curve) CurveOnSurface (const TopoDS_Edge& E, const TopoDS_Face& F, Standard_Real& First, Standard_Real& Last); |
99 | |
100 | //! Returns the curve associated to the edge in the |
101 | //! parametric space of the surface. Returns a NULL |
102 | //! handle if this curve does not exist. Returns in |
103 | //! <First> and <Last> the parameter range. |
104 | Standard_EXPORT static Handle(Geom2d_Curve) CurveOnSurface (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, Standard_Real& First, Standard_Real& Last); |
105 | |
106 | //! Returns in <C>, <S>, <L> a 2d curve, a surface and |
107 | //! a location for the edge <E>. <C> and <S> are null |
108 | //! if the edge has no curve on surface. Returns in |
109 | //! <First> and <Last> the parameter range. |
110 | Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& E, Handle(Geom2d_Curve)& C, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& First, Standard_Real& Last); |
111 | |
112 | //! Returns in <C>, <S>, <L> the 2d curve, the surface |
113 | //! and the location for the edge <E> of rank <Index>. |
114 | //! <C> and <S> are null if the index is out of range. |
115 | //! Returns in <First> and <Last> the parameter range. |
116 | Standard_EXPORT static void CurveOnSurface (const TopoDS_Edge& E, Handle(Geom2d_Curve)& C, Handle(Geom_Surface)& S, TopLoc_Location& L, Standard_Real& First, Standard_Real& Last, const Standard_Integer Index); |
117 | |
118 | //! Returns the polygon associated to the edge in the |
119 | //! parametric space of the face. Returns a NULL |
120 | //! handle if this polygon does not exist. |
121 | Standard_EXPORT static Handle(Poly_Polygon2D) PolygonOnSurface (const TopoDS_Edge& E, const TopoDS_Face& F); |
122 | |
123 | //! Returns the polygon associated to the edge in the |
124 | //! parametric space of the surface. Returns a NULL |
125 | //! handle if this polygon does not exist. |
126 | Standard_EXPORT static Handle(Poly_Polygon2D) PolygonOnSurface (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L); |
127 | |
128 | //! Returns in <C>, <S>, <L> a 2d curve, a surface and |
129 | //! a location for the edge <E>. <C> and <S> are null |
130 | //! if the edge has no polygon on surface. |
131 | Standard_EXPORT static void PolygonOnSurface (const TopoDS_Edge& E, Handle(Poly_Polygon2D)& C, Handle(Geom_Surface)& S, TopLoc_Location& L); |
132 | |
133 | //! Returns in <C>, <S>, <L> the 2d curve, the surface |
134 | //! and the location for the edge <E> of rank <Index>. |
135 | //! <C> and <S> are null if the index is out of range. |
136 | Standard_EXPORT static void PolygonOnSurface (const TopoDS_Edge& E, Handle(Poly_Polygon2D)& C, Handle(Geom_Surface)& S, TopLoc_Location& L, const Standard_Integer Index); |
137 | |
138 | //! Returns the polygon associated to the edge in the |
139 | //! parametric space of the face. Returns a NULL |
140 | //! handle if this polygon does not exist. |
141 | Standard_EXPORT static const Handle(Poly_PolygonOnTriangulation)& PolygonOnTriangulation (const TopoDS_Edge& E, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L); |
142 | |
143 | //! Returns in <P>, <T>, <L> a polygon on triangulation, a |
144 | //! triangulation and a location for the edge <E>. |
145 | //! <P> and <T> are null if the edge has no |
146 | //! polygon on triangulation. |
147 | Standard_EXPORT static void PolygonOnTriangulation (const TopoDS_Edge& E, Handle(Poly_PolygonOnTriangulation)& P, Handle(Poly_Triangulation)& T, TopLoc_Location& L); |
148 | |
149 | //! Returns in <P>, <T>, <L> a polygon on |
150 | //! triangulation, a triangulation and a location for |
151 | //! the edge <E> for the range index. <C> and <S> are |
152 | //! null if the edge has no polygon on triangulation. |
153 | Standard_EXPORT static void PolygonOnTriangulation (const TopoDS_Edge& E, Handle(Poly_PolygonOnTriangulation)& P, Handle(Poly_Triangulation)& T, TopLoc_Location& L, const Standard_Integer Index); |
154 | |
155 | //! Returns True if <E> has two PCurves in the |
156 | //! parametric space of <F>. i.e. <F> is on a closed |
157 | //! surface and <E> is on the closing curve. |
158 | Standard_EXPORT static Standard_Boolean IsClosed (const TopoDS_Edge& E, const TopoDS_Face& F); |
159 | |
160 | //! Returns True if <E> has two PCurves in the |
161 | //! parametric space of <S>. i.e. <S> is a closed |
162 | //! surface and <E> is on the closing curve. |
163 | Standard_EXPORT static Standard_Boolean IsClosed (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L); |
164 | |
165 | //! Returns True if <E> has two arrays of indices in |
166 | //! the triangulation <T>. |
167 | Standard_EXPORT static Standard_Boolean IsClosed (const TopoDS_Edge& E, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L); |
168 | |
169 | //! Returns the tolerance for <E>. |
170 | Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Edge& E); |
171 | |
172 | //! Returns the SameParameter flag for the edge. |
173 | Standard_EXPORT static Standard_Boolean SameParameter (const TopoDS_Edge& E); |
174 | |
175 | //! Returns the SameRange flag for the edge. |
176 | Standard_EXPORT static Standard_Boolean SameRange (const TopoDS_Edge& E); |
177 | |
178 | //! Returns True if the edge is degenerated. |
179 | Standard_EXPORT static Standard_Boolean Degenerated (const TopoDS_Edge& E); |
180 | |
181 | //! Gets the range of the 3d curve. |
182 | Standard_EXPORT static void Range (const TopoDS_Edge& E, Standard_Real& First, Standard_Real& Last); |
183 | |
184 | //! Gets the range of the edge on the pcurve on the |
185 | //! surface. |
186 | Standard_EXPORT static void Range (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, Standard_Real& First, Standard_Real& Last); |
187 | |
188 | //! Gets the range of the edge on the pcurve on the face. |
189 | Standard_EXPORT static void Range (const TopoDS_Edge& E, const TopoDS_Face& F, Standard_Real& First, Standard_Real& Last); |
190 | |
191 | //! Gets the UV locations of the extremities of the edge. |
192 | Standard_EXPORT static void UVPoints (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, gp_Pnt2d& PFirst, gp_Pnt2d& PLast); |
193 | |
194 | //! Gets the UV locations of the extremities of the edge. |
195 | Standard_EXPORT static void UVPoints (const TopoDS_Edge& E, const TopoDS_Face& F, gp_Pnt2d& PFirst, gp_Pnt2d& PLast); |
196 | |
197 | //! Sets the UV locations of the extremities of the edge. |
198 | Standard_EXPORT static void SetUVPoints (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const gp_Pnt2d& PFirst, const gp_Pnt2d& PLast); |
199 | |
200 | //! Sets the UV locations of the extremities of the edge. |
201 | Standard_EXPORT static void SetUVPoints (const TopoDS_Edge& E, const TopoDS_Face& F, const gp_Pnt2d& PFirst, const gp_Pnt2d& PLast); |
202 | |
203 | //! Returns True if the edge is on the surfaces of the |
204 | //! two faces. |
205 | Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2); |
206 | |
207 | //! Returns the continuity. |
208 | Standard_EXPORT static GeomAbs_Shape Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2); |
209 | |
210 | //! Returns True if the edge is on the surfaces. |
211 | Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E, const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const TopLoc_Location& L1, const TopLoc_Location& L2); |
212 | |
213 | //! Returns the continuity. |
214 | Standard_EXPORT static GeomAbs_Shape Continuity (const TopoDS_Edge& E, const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const TopLoc_Location& L1, const TopLoc_Location& L2); |
215 | |
216 | //! Returns True if the edge has regularity on some |
217 | //! two surfaces |
218 | Standard_EXPORT static Standard_Boolean HasContinuity (const TopoDS_Edge& E); |
219 | |
220 | //! Returns the 3d point. |
221 | Standard_EXPORT static gp_Pnt Pnt (const TopoDS_Vertex& V); |
222 | |
223 | //! Returns the tolerance. |
224 | Standard_EXPORT static Standard_Real Tolerance (const TopoDS_Vertex& V); |
225 | |
226 | //! Returns the parameter of <V> on <E>. |
227 | Standard_EXPORT static Standard_Real Parameter (const TopoDS_Vertex& V, const TopoDS_Edge& E); |
228 | |
229 | //! Returns the parameters of the vertex on the |
230 | //! pcurve of the edge on the face. |
231 | Standard_EXPORT static Standard_Real Parameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, const TopoDS_Face& F); |
232 | |
233 | //! Returns the parameters of the vertex on the |
234 | //! pcurve of the edge on the surface. |
235 | Standard_EXPORT static Standard_Real Parameter (const TopoDS_Vertex& V, const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L); |
236 | |
237 | //! Returns the parameters of the vertex on the face. |
238 | Standard_EXPORT static gp_Pnt2d Parameters (const TopoDS_Vertex& V, const TopoDS_Face& F); |
239 | |
42cf5bc1 |
240 | }; |
241 | |
42cf5bc1 |
242 | #endif // _BRep_Tool_HeaderFile |