1 // Created on: 1991-07-01
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRep_Builder_HeaderFile
18 #define _BRep_Builder_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopoDS_Builder.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <GeomAbs_Shape.hxx>
28 class Standard_NullObject;
29 class Standard_DomainError;
32 class TopLoc_Location;
33 class Poly_Triangulation;
37 class Poly_PolygonOnTriangulation;
45 //! A framework providing advanced tolerance control.
46 //! It is used to build Shapes.
47 //! If tolerance control is required, you are advised to:
48 //! 1. build a default precision for topology, using the
49 //! classes provided in the BRepAPI package
50 //! 2. update the tolerance of the resulting shape.
51 //! Note that only vertices, edges and faces have
52 //! meaningful tolerance control. The tolerance value
53 //! must always comply with the condition that face
54 //! tolerances are more restrictive than edge tolerances
55 //! which are more restrictive than vertex tolerances. In
56 //! other words: Tol(Vertex) >= Tol(Edge) >= Tol(Face).
57 //! Other rules in setting tolerance include:
58 //! - you can open up tolerance but should never restrict it
59 //! - an edge cannot be included within the fusion of the
60 //! tolerance spheres of two vertices
61 class BRep_Builder : public TopoDS_Builder
68 //! Makes an undefined Face.
69 void MakeFace (TopoDS_Face& F) const;
71 //! Makes a Face with a surface.
72 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const Standard_Real Tol) const;
74 //! Makes a Face with a surface and a location.
75 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
77 //! Makes a Face with a triangulation. The triangulation
78 //! is in the same reference system than the TFace.
79 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
81 //! Updates the face F using the tolerance value Tol,
82 //! surface S and location Location.
83 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
85 //! Changes a face triangulation.
87 //! A null Triangulation removes the triangulation.
88 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const;
90 //! Updates the face Tolerance.
91 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Standard_Real Tol) const;
93 //! Sets the NaturalRestriction flag of the face.
94 Standard_EXPORT void NaturalRestriction (const TopoDS_Face& F, const Standard_Boolean N) const;
96 //! Makes an undefined Edge (no geometry).
97 Standard_EXPORT void MakeEdge (TopoDS_Edge& E) const;
99 //! Makes an Edge with a curve.
100 void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
102 //! Makes an Edge with a curve and a location.
103 void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const;
105 //! Makes an Edge with a polygon 3d.
106 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
108 //! makes an Edge polygon on Triangulation.
109 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const;
111 //! makes an Edge polygon on Triangulation.
112 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
114 //! Sets a 3D curve for the edge.
115 //! If <C> is a null handle, remove any existing 3d curve.
116 void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
118 //! Sets a 3D curve for the edge.
119 //! If <C> is a null handle, remove any existing 3d curve.
120 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const;
122 //! Sets a pcurve for the edge on the face.
123 //! If <C> is a null handle, remove any existing pcurve.
124 void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const TopoDS_Face& F, const Standard_Real Tol) const;
126 //! Sets pcurves for the edge on the closed face. If
127 //! <C1> or <C2> is a null handle, remove any existing
129 void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const TopoDS_Face& F, const Standard_Real Tol) const;
131 //! Sets a pcurve for the edge on the face.
132 //! If <C> is a null handle, remove any existing pcurve.
133 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
135 //! Sets a pcurve for the edge on the face.
136 //! If <C> is a null handle, remove any existing pcurve.
137 //! Sets UV bounds for curve repsentation
138 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol, const gp_Pnt2d& Pf, const gp_Pnt2d& Pl) const;
140 //! Sets pcurves for the edge on the closed surface.
141 //! <C1> or <C2> is a null handle, remove any existing
143 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
145 //! Sets pcurves for the edge on the closed surface.
146 //! <C1> or <C2> is a null handle, remove any existing
148 //! Sets UV bounds for curve repsentation
149 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol, const gp_Pnt2d& Pf, const gp_Pnt2d& Pl) const;
151 //! Changes an Edge 3D polygon.
152 //! A null Polygon removes the 3d Polygon.
153 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
155 //! Changes an Edge 3D polygon.
156 //! A null Polygon removes the 3d Polygon.
157 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P, const TopLoc_Location& L) const;
159 //! Changes an Edge polygon on Triangulation.
160 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const;
162 //! Changes an Edge polygon on Triangulation.
163 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
165 //! Changes an Edge polygon on Triangulation.
166 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N1, const Handle(Poly_PolygonOnTriangulation)& N2, const Handle(Poly_Triangulation)& T) const;
168 //! Changes an Edge polygon on Triangulation.
169 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N1, const Handle(Poly_PolygonOnTriangulation)& N2, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const;
171 //! Changes Edge polygon on a face.
172 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const TopoDS_Face& S) const;
174 //! Changes Edge polygon on a face.
175 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const Handle(Geom_Surface)& S, const TopLoc_Location& T) const;
177 //! Changes Edge polygons on a face.
179 //! A null Polygon removes the 2d Polygon.
180 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P1, const Handle(Poly_Polygon2D)& P2, const TopoDS_Face& S) const;
182 //! Changes Edge polygons on a face.
184 //! A null Polygon removes the 2d Polygon.
185 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P1, const Handle(Poly_Polygon2D)& P2, const Handle(Geom_Surface)& S, const TopLoc_Location& L) const;
187 //! Updates the edge tolerance.
188 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Standard_Real Tol) const;
190 //! Sets the geometric continuity on the edge.
191 Standard_EXPORT void Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const GeomAbs_Shape C) const;
193 //! Sets the geometric continuity on the edge.
194 Standard_EXPORT void Continuity (const TopoDS_Edge& E, const Handle(Geom_Surface)& S1, const Handle(Geom_Surface)& S2, const TopLoc_Location& L1, const TopLoc_Location& L2, const GeomAbs_Shape C) const;
196 //! Sets the same parameter flag for the edge <E>.
197 Standard_EXPORT void SameParameter (const TopoDS_Edge& E, const Standard_Boolean S) const;
199 //! Sets the same range flag for the edge <E>.
200 Standard_EXPORT void SameRange (const TopoDS_Edge& E, const Standard_Boolean S) const;
202 //! Sets the degenerated flag for the edge <E>.
203 Standard_EXPORT void Degenerated (const TopoDS_Edge& E, const Standard_Boolean D) const;
205 //! Sets the range of the 3d curve if Only3d=TRUE,
206 //! otherwise sets the range to all the representations
207 Standard_EXPORT void Range (const TopoDS_Edge& E, const Standard_Real First, const Standard_Real Last, const Standard_Boolean Only3d = Standard_False) const;
209 //! Sets the range of the edge on the pcurve on the
211 Standard_EXPORT void Range (const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real First, const Standard_Real Last) const;
213 //! Sets the range of the edge on the pcurve on the face.
214 void Range (const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real First, const Standard_Real Last) const;
216 //! Add to <Eout> the geometric representations of
218 Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout) const;
220 //! Makes an udefined vertex without geometry.
221 void MakeVertex (TopoDS_Vertex& V) const;
223 //! Makes a vertex from a 3D point.
224 void MakeVertex (TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const;
226 //! Sets a 3D point on the vertex.
227 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const;
229 //! Sets the parameter for the vertex on the edge
231 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const Standard_Real Tol) const;
233 //! Sets the parameter for the vertex on the edge
234 //! pcurve on the face.
235 void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real Tol) const;
237 //! Sets the parameter for the vertex on the edge
238 //! pcurve on the surface.
239 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const;
241 //! Sets the parameters for the vertex on the face.
242 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& Ve, const Standard_Real U, const Standard_Real V, const TopoDS_Face& F, const Standard_Real Tol) const;
244 //! Updates the vertex tolerance.
245 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real Tol) const;
247 //! Transfert the parameters of Vin on Ein as the
248 //! parameter of Vout on Eout.
249 Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout, const TopoDS_Vertex& Vin, const TopoDS_Vertex& Vout) const;
269 #include <BRep_Builder.lxx>
275 #endif // _BRep_Builder_HeaderFile