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 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_Builder_HeaderFile 18 #define _BRep_Builder_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <TopoDS_Builder.hxx> 25 #include <Geom2d_Curve.hxx> 26 #include <Geom_Curve.hxx> 27 #include <Geom_Surface.hxx> 28 #include <GeomAbs_Shape.hxx> 29 #include <Poly_Polygon3D.hxx> 30 #include <Poly_PolygonOnTriangulation.hxx> 31 #include <Poly_Triangulation.hxx> 32 33 class Standard_NullObject; 34 class Standard_DomainError; 35 class TopoDS_Face; 36 class Geom_Surface; 37 class TopLoc_Location; 38 class Poly_Triangulation; 39 class TopoDS_Edge; 40 class Geom_Curve; 41 class Poly_Polygon3D; 42 class Poly_PolygonOnTriangulation; 43 class Geom2d_Curve; 44 class gp_Pnt2d; 45 class Poly_Polygon2D; 46 class TopoDS_Vertex; 47 class gp_Pnt; 48 49 50 //! A framework providing advanced tolerance control. 51 //! It is used to build Shapes. 52 //! If tolerance control is required, you are advised to: 53 //! 1. build a default precision for topology, using the 54 //! classes provided in the BRepAPI package 55 //! 2. update the tolerance of the resulting shape. 56 //! Note that only vertices, edges and faces have 57 //! meaningful tolerance control. The tolerance value 58 //! must always comply with the condition that face 59 //! tolerances are more restrictive than edge tolerances 60 //! which are more restrictive than vertex tolerances. In 61 //! other words: Tol(Vertex) >= Tol(Edge) >= Tol(Face). 62 //! Other rules in setting tolerance include: 63 //! - you can open up tolerance but should never restrict it 64 //! - an edge cannot be included within the fusion of the 65 //! tolerance spheres of two vertices 66 class BRep_Builder : public TopoDS_Builder 67 { 68 public: 69 70 DEFINE_STANDARD_ALLOC 71 72 73 //! Makes an undefined Face. 74 void MakeFace (TopoDS_Face& F) const; 75 76 //! Makes a Face with a surface. 77 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const Standard_Real Tol) const; 78 79 //! Makes a Face with a surface and a location. 80 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const; 81 82 //! Makes a Face with a triangulation. The triangulation 83 //! is in the same reference system than the TFace. 84 Standard_EXPORT void MakeFace (TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const; 85 86 //! Updates the face F using the tolerance value Tol, 87 //! surface S and location Location. 88 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Geom_Surface)& S, const TopLoc_Location& L, const Standard_Real Tol) const; 89 90 //! Changes a face triangulation. 91 //! 92 //! A null Triangulation removes the triangulation. 93 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Handle(Poly_Triangulation)& T) const; 94 95 //! Updates the face Tolerance. 96 Standard_EXPORT void UpdateFace (const TopoDS_Face& F, const Standard_Real Tol) const; 97 98 //! Sets the NaturalRestriction flag of the face. 99 Standard_EXPORT void NaturalRestriction (const TopoDS_Face& F, const Standard_Boolean N) const; 100 101 //! Makes an undefined Edge (no geometry). 102 Standard_EXPORT void MakeEdge (TopoDS_Edge& E) const; 103 104 //! Makes an Edge with a curve. 105 void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const; 106 107 //! Makes an Edge with a curve and a location. 108 void MakeEdge (TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const; 109 110 //! Makes an Edge with a polygon 3d. 111 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const; 112 113 //! makes an Edge polygon on Triangulation. 114 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const; 115 116 //! makes an Edge polygon on Triangulation. 117 void MakeEdge (TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const; 118 119 //! Sets a 3D curve for the edge. 120 //! If <C> is a null handle, remove any existing 3d curve. 121 void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const; 122 123 //! Sets a 3D curve for the edge. 124 //! If <C> is a null handle, remove any existing 3d curve. 125 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const TopLoc_Location& L, const Standard_Real Tol) const; 126 127 //! Sets a pcurve for the edge on the face. 128 //! If <C> is a null handle, remove any existing pcurve. 129 void UpdateEdge (const TopoDS_Edge& E, const Handle(Geom2d_Curve)& C, const TopoDS_Face& F, const Standard_Real Tol) const; 130 131 //! Sets pcurves for the edge on the closed face. If 132 //! <C1> or <C2> is a null handle, remove any existing 133 //! pcurve. 134 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; 135 136 //! Sets a pcurve for the edge on the face. 137 //! If <C> is a null handle, remove any existing pcurve. 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; 139 140 //! Sets a pcurve for the edge on the face. 141 //! If <C> is a null handle, remove any existing pcurve. 142 //! Sets UV bounds for curve repsentation 143 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; 144 145 //! Sets pcurves for the edge on the closed surface. 146 //! <C1> or <C2> is a null handle, remove any existing 147 //! pcurve. 148 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; 149 150 //! Sets pcurves for the edge on the closed surface. 151 //! <C1> or <C2> is a null handle, remove any existing 152 //! pcurve. 153 //! Sets UV bounds for curve repsentation 154 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; 155 156 //! Changes an Edge 3D polygon. 157 //! A null Polygon removes the 3d Polygon. 158 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const; 159 160 //! Changes an Edge 3D polygon. 161 //! A null Polygon removes the 3d Polygon. 162 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P, const TopLoc_Location& L) const; 163 164 //! Changes an Edge polygon on Triangulation. 165 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T) const; 166 167 //! Changes an Edge polygon on Triangulation. 168 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N, const Handle(Poly_Triangulation)& T, const TopLoc_Location& L) const; 169 170 //! Changes an Edge polygon on Triangulation. 171 void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_PolygonOnTriangulation)& N1, const Handle(Poly_PolygonOnTriangulation)& N2, const Handle(Poly_Triangulation)& T) const; 172 173 //! Changes an Edge polygon on Triangulation. 174 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; 175 176 //! Changes Edge polygon on a face. 177 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const TopoDS_Face& S) const; 178 179 //! Changes Edge polygon on a face. 180 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Handle(Poly_Polygon2D)& P, const Handle(Geom_Surface)& S, const TopLoc_Location& T) const; 181 182 //! Changes Edge polygons on a face. 183 //! 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 TopoDS_Face& S) const; 186 187 //! Changes Edge polygons on a face. 188 //! 189 //! A null Polygon removes the 2d Polygon. 190 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; 191 192 //! Updates the edge tolerance. 193 Standard_EXPORT void UpdateEdge (const TopoDS_Edge& E, const Standard_Real Tol) const; 194 195 //! Sets the geometric continuity on the edge. 196 Standard_EXPORT void Continuity (const TopoDS_Edge& E, const TopoDS_Face& F1, const TopoDS_Face& F2, const GeomAbs_Shape C) const; 197 198 //! Sets the geometric continuity on the edge. 199 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; 200 201 //! Sets the same parameter flag for the edge <E>. 202 Standard_EXPORT void SameParameter (const TopoDS_Edge& E, const Standard_Boolean S) const; 203 204 //! Sets the same range flag for the edge <E>. 205 Standard_EXPORT void SameRange (const TopoDS_Edge& E, const Standard_Boolean S) const; 206 207 //! Sets the degenerated flag for the edge <E>. 208 Standard_EXPORT void Degenerated (const TopoDS_Edge& E, const Standard_Boolean D) const; 209 210 //! Sets the range of the 3d curve if Only3d=TRUE, 211 //! otherwise sets the range to all the representations 212 Standard_EXPORT void Range (const TopoDS_Edge& E, const Standard_Real First, const Standard_Real Last, const Standard_Boolean Only3d = Standard_False) const; 213 214 //! Sets the range of the edge on the pcurve on the 215 //! surface. 216 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; 217 218 //! Sets the range of the edge on the pcurve on the face. 219 void Range (const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real First, const Standard_Real Last) const; 220 221 //! Add to <Eout> the geometric representations of 222 //! <Ein>. 223 Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout) const; 224 225 //! Makes an udefined vertex without geometry. 226 void MakeVertex (TopoDS_Vertex& V) const; 227 228 //! Makes a vertex from a 3D point. 229 void MakeVertex (TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const; 230 231 //! Sets a 3D point on the vertex. 232 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const gp_Pnt& P, const Standard_Real Tol) const; 233 234 //! Sets the parameter for the vertex on the edge 235 //! curves. 236 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const Standard_Real Tol) const; 237 238 //! Sets the parameter for the vertex on the edge 239 //! pcurve on the face. 240 void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real P, const TopoDS_Edge& E, const TopoDS_Face& F, const Standard_Real Tol) const; 241 242 //! Sets the parameter for the vertex on the edge 243 //! pcurve on the surface. 244 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; 245 246 //! Sets the parameters for the vertex on the face. 247 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; 248 249 //! Updates the vertex tolerance. 250 Standard_EXPORT void UpdateVertex (const TopoDS_Vertex& V, const Standard_Real Tol) const; 251 252 //! Transfert the parameters of Vin on Ein as the 253 //! parameter of Vout on Eout. 254 Standard_EXPORT void Transfert (const TopoDS_Edge& Ein, const TopoDS_Edge& Eout, const TopoDS_Vertex& Vin, const TopoDS_Vertex& Vout) const; 255 256 257 258 259 protected: 260 261 262 263 264 265 private: 266 267 268 269 270 271 }; 272 273 274 #include <BRep_Builder.lxx> 275 276 277 278 279 280 #endif // _BRep_Builder_HeaderFile 281