Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-12-03 10:54:05

0001 // Created on: 1991-07-01
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRep_Builder_HeaderFile
0018 #define _BRep_Builder_HeaderFile
0019 
0020 #include <GeomAbs_Shape.hxx>
0021 #include <Poly_Triangulation.hxx>
0022 #include <Standard.hxx>
0023 #include <Standard_DefineAlloc.hxx>
0024 #include <Standard_Handle.hxx>
0025 #include <TopoDS_Builder.hxx>
0026 
0027 class TopoDS_Face;
0028 class Geom_Surface;
0029 class TopLoc_Location;
0030 class Poly_Triangulation;
0031 class TopoDS_Edge;
0032 class Geom_Curve;
0033 class Poly_Polygon3D;
0034 class Poly_PolygonOnTriangulation;
0035 class Geom2d_Curve;
0036 class gp_Pnt2d;
0037 class Poly_Polygon2D;
0038 class TopoDS_Vertex;
0039 class gp_Pnt;
0040 
0041 //! A framework providing advanced tolerance control.
0042 //! It is used to build Shapes.
0043 //! If tolerance control is required, you are advised to:
0044 //! 1. build a default precision for topology, using the
0045 //! classes provided in the BRepAPI package
0046 //! 2. update the tolerance of the resulting shape.
0047 //! Note that only vertices, edges and faces have
0048 //! meaningful tolerance control. The tolerance value
0049 //! must always comply with the condition that face
0050 //! tolerances are more restrictive than edge tolerances
0051 //! which are more restrictive than vertex tolerances. In
0052 //! other words: Tol(Vertex) >= Tol(Edge) >= Tol(Face).
0053 //! Other rules in setting tolerance include:
0054 //! - you can open up tolerance but should never restrict it
0055 //! - an edge cannot be included within the fusion of the
0056 //! tolerance spheres of two vertices
0057 class BRep_Builder : public TopoDS_Builder
0058 {
0059 public:
0060   DEFINE_STANDARD_ALLOC
0061 
0062   //! Makes an undefined Face.
0063   void MakeFace(TopoDS_Face& F) const;
0064 
0065   //! Makes a Face with a surface.
0066   Standard_EXPORT void MakeFace(TopoDS_Face&                     F,
0067                                 const occ::handle<Geom_Surface>& S,
0068                                 const double                     Tol) const;
0069 
0070   //! Makes a Face with a surface and a location.
0071   Standard_EXPORT void MakeFace(TopoDS_Face&                     F,
0072                                 const occ::handle<Geom_Surface>& S,
0073                                 const TopLoc_Location&           L,
0074                                 const double                     Tol) const;
0075 
0076   //! Makes a theFace with a single triangulation. The triangulation
0077   //! is in the same reference system than the TFace.
0078   Standard_EXPORT void MakeFace(TopoDS_Face&                           theFace,
0079                                 const occ::handle<Poly_Triangulation>& theTriangulation) const;
0080 
0081   //! Makes a Face with a list of triangulations and active one.
0082   //! Use NULL active triangulation to set the first triangulation in list as active.
0083   //! The triangulations is in the same reference system than the TFace.
0084   Standard_EXPORT void MakeFace(
0085     TopoDS_Face&                                             theFace,
0086     const NCollection_List<occ::handle<Poly_Triangulation>>& theTriangulations,
0087     const occ::handle<Poly_Triangulation>&                   theActiveTriangulation =
0088       occ::handle<Poly_Triangulation>()) const;
0089 
0090   //! Updates the face F using the tolerance value Tol,
0091   //! surface S and location Location.
0092   Standard_EXPORT void UpdateFace(const TopoDS_Face&               F,
0093                                   const occ::handle<Geom_Surface>& S,
0094                                   const TopLoc_Location&           L,
0095                                   const double                     Tol) const;
0096 
0097   //! Changes a face triangulation.
0098   //! A NULL theTriangulation removes face triangulations.
0099   //! If theToReset is TRUE face triangulations will be reset to new list with only one input
0100   //! triangulation that will be active. Else if theTriangulation is contained in internal
0101   //! triangulations list it will be made active,
0102   //!      else the active triangulation will be replaced to theTriangulation one.
0103   Standard_EXPORT void UpdateFace(const TopoDS_Face&                     theFace,
0104                                   const occ::handle<Poly_Triangulation>& theTriangulation,
0105                                   const bool                             theToReset = true) const;
0106 
0107   //! Updates the face Tolerance.
0108   Standard_EXPORT void UpdateFace(const TopoDS_Face& F, const double Tol) const;
0109 
0110   //! Sets the NaturalRestriction flag of the face.
0111   Standard_EXPORT void NaturalRestriction(const TopoDS_Face& F, const bool N) const;
0112 
0113   //! Makes an undefined Edge (no geometry).
0114   Standard_EXPORT void MakeEdge(TopoDS_Edge& E) const;
0115 
0116   //! Makes an Edge with a curve.
0117   void MakeEdge(TopoDS_Edge& E, const occ::handle<Geom_Curve>& C, const double Tol) const;
0118 
0119   //! Makes an Edge with a curve and a location.
0120   void MakeEdge(TopoDS_Edge&                   E,
0121                 const occ::handle<Geom_Curve>& C,
0122                 const TopLoc_Location&         L,
0123                 const double                   Tol) const;
0124 
0125   //! Makes an Edge with a polygon 3d.
0126   void MakeEdge(TopoDS_Edge& E, const occ::handle<Poly_Polygon3D>& P) const;
0127 
0128   //! makes an Edge polygon on Triangulation.
0129   void MakeEdge(TopoDS_Edge&                                    E,
0130                 const occ::handle<Poly_PolygonOnTriangulation>& N,
0131                 const occ::handle<Poly_Triangulation>&          T) const;
0132 
0133   //! makes an Edge polygon on Triangulation.
0134   void MakeEdge(TopoDS_Edge&                                    E,
0135                 const occ::handle<Poly_PolygonOnTriangulation>& N,
0136                 const occ::handle<Poly_Triangulation>&          T,
0137                 const TopLoc_Location&                          L) const;
0138 
0139   //! Sets a 3D curve for the edge.
0140   //! If <C> is a null handle, remove any existing 3d curve.
0141   void UpdateEdge(const TopoDS_Edge& E, const occ::handle<Geom_Curve>& C, const double Tol) const;
0142 
0143   //! Sets a 3D curve for the edge.
0144   //! If <C> is a null handle, remove any existing 3d curve.
0145   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&             E,
0146                                   const occ::handle<Geom_Curve>& C,
0147                                   const TopLoc_Location&         L,
0148                                   const double                   Tol) const;
0149 
0150   //! Sets a pcurve for the edge on the face.
0151   //! If <C> is a null handle, remove any existing pcurve.
0152   void UpdateEdge(const TopoDS_Edge&               E,
0153                   const occ::handle<Geom2d_Curve>& C,
0154                   const TopoDS_Face&               F,
0155                   const double                     Tol) const;
0156 
0157   //! Sets pcurves for the edge on the closed face. If
0158   //! <C1> or <C2> is a null handle, remove any existing
0159   //! pcurve.
0160   void UpdateEdge(const TopoDS_Edge&               E,
0161                   const occ::handle<Geom2d_Curve>& C1,
0162                   const occ::handle<Geom2d_Curve>& C2,
0163                   const TopoDS_Face&               F,
0164                   const double                     Tol) const;
0165 
0166   //! Sets a pcurve for the edge on the face.
0167   //! If <C> is a null handle, remove any existing pcurve.
0168   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&               E,
0169                                   const occ::handle<Geom2d_Curve>& C,
0170                                   const occ::handle<Geom_Surface>& S,
0171                                   const TopLoc_Location&           L,
0172                                   const double                     Tol) const;
0173 
0174   //! Sets a pcurve for the edge on the face.
0175   //! If <C> is a null handle, remove any existing pcurve.
0176   //! Sets UV bounds for curve repsentation
0177   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&               E,
0178                                   const occ::handle<Geom2d_Curve>& C,
0179                                   const occ::handle<Geom_Surface>& S,
0180                                   const TopLoc_Location&           L,
0181                                   const double                     Tol,
0182                                   const gp_Pnt2d&                  Pf,
0183                                   const gp_Pnt2d&                  Pl) const;
0184 
0185   //! Sets pcurves for the edge on the closed surface.
0186   //! <C1> or <C2> is a null handle, remove any existing
0187   //! pcurve.
0188   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&               E,
0189                                   const occ::handle<Geom2d_Curve>& C1,
0190                                   const occ::handle<Geom2d_Curve>& C2,
0191                                   const occ::handle<Geom_Surface>& S,
0192                                   const TopLoc_Location&           L,
0193                                   const double                     Tol) const;
0194 
0195   //! Sets pcurves for the edge on the closed surface.
0196   //! <C1> or <C2> is a null handle, remove any existing
0197   //! pcurve.
0198   //! Sets UV bounds for curve repsentation
0199   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&               E,
0200                                   const occ::handle<Geom2d_Curve>& C1,
0201                                   const occ::handle<Geom2d_Curve>& C2,
0202                                   const occ::handle<Geom_Surface>& S,
0203                                   const TopLoc_Location&           L,
0204                                   const double                     Tol,
0205                                   const gp_Pnt2d&                  Pf,
0206                                   const gp_Pnt2d&                  Pl) const;
0207 
0208   //! Changes an Edge 3D polygon.
0209   //! A null Polygon removes the 3d Polygon.
0210   void UpdateEdge(const TopoDS_Edge& E, const occ::handle<Poly_Polygon3D>& P) const;
0211 
0212   //! Changes an Edge 3D polygon.
0213   //! A null Polygon removes the 3d Polygon.
0214   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                 E,
0215                                   const occ::handle<Poly_Polygon3D>& P,
0216                                   const TopLoc_Location&             L) const;
0217 
0218   //! Changes an Edge polygon on Triangulation.
0219   void UpdateEdge(const TopoDS_Edge&                              E,
0220                   const occ::handle<Poly_PolygonOnTriangulation>& N,
0221                   const occ::handle<Poly_Triangulation>&          T) const;
0222 
0223   //! Changes an Edge polygon on Triangulation.
0224   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                              E,
0225                                   const occ::handle<Poly_PolygonOnTriangulation>& N,
0226                                   const occ::handle<Poly_Triangulation>&          T,
0227                                   const TopLoc_Location&                          L) const;
0228 
0229   //! Changes an Edge polygon on Triangulation.
0230   void UpdateEdge(const TopoDS_Edge&                              E,
0231                   const occ::handle<Poly_PolygonOnTriangulation>& N1,
0232                   const occ::handle<Poly_PolygonOnTriangulation>& N2,
0233                   const occ::handle<Poly_Triangulation>&          T) const;
0234 
0235   //! Changes an Edge polygon on Triangulation.
0236   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                              E,
0237                                   const occ::handle<Poly_PolygonOnTriangulation>& N1,
0238                                   const occ::handle<Poly_PolygonOnTriangulation>& N2,
0239                                   const occ::handle<Poly_Triangulation>&          T,
0240                                   const TopLoc_Location&                          L) const;
0241 
0242   //! Changes Edge polygon on a face.
0243   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                 E,
0244                                   const occ::handle<Poly_Polygon2D>& P,
0245                                   const TopoDS_Face&                 S) const;
0246 
0247   //! Changes Edge polygon on a face.
0248   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                 E,
0249                                   const occ::handle<Poly_Polygon2D>& P,
0250                                   const occ::handle<Geom_Surface>&   S,
0251                                   const TopLoc_Location&             T) const;
0252 
0253   //! Changes Edge polygons on a face.
0254   //!
0255   //! A null Polygon removes the 2d Polygon.
0256   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                 E,
0257                                   const occ::handle<Poly_Polygon2D>& P1,
0258                                   const occ::handle<Poly_Polygon2D>& P2,
0259                                   const TopoDS_Face&                 S) const;
0260 
0261   //! Changes Edge polygons on a face.
0262   //!
0263   //! A null Polygon removes the 2d Polygon.
0264   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                 E,
0265                                   const occ::handle<Poly_Polygon2D>& P1,
0266                                   const occ::handle<Poly_Polygon2D>& P2,
0267                                   const occ::handle<Geom_Surface>&   S,
0268                                   const TopLoc_Location&             L) const;
0269 
0270   //! Updates the edge tolerance.
0271   Standard_EXPORT void UpdateEdge(const TopoDS_Edge& E, const double Tol) const;
0272 
0273   //! Sets the geometric continuity on the edge.
0274   Standard_EXPORT void Continuity(const TopoDS_Edge&  E,
0275                                   const TopoDS_Face&  F1,
0276                                   const TopoDS_Face&  F2,
0277                                   const GeomAbs_Shape C) const;
0278 
0279   //! Sets the geometric continuity on the edge.
0280   Standard_EXPORT void Continuity(const TopoDS_Edge&               E,
0281                                   const occ::handle<Geom_Surface>& S1,
0282                                   const occ::handle<Geom_Surface>& S2,
0283                                   const TopLoc_Location&           L1,
0284                                   const TopLoc_Location&           L2,
0285                                   const GeomAbs_Shape              C) const;
0286 
0287   //! Sets the same parameter flag for the edge <E>.
0288   Standard_EXPORT void SameParameter(const TopoDS_Edge& E, const bool S) const;
0289 
0290   //! Sets the same range flag for the edge <E>.
0291   Standard_EXPORT void SameRange(const TopoDS_Edge& E, const bool S) const;
0292 
0293   //! Sets the degenerated flag for the edge <E>.
0294   Standard_EXPORT void Degenerated(const TopoDS_Edge& E, const bool D) const;
0295 
0296   //! Sets the range of the 3d curve if Only3d=TRUE,
0297   //! otherwise sets the range to all the representations
0298   Standard_EXPORT void Range(const TopoDS_Edge& E,
0299                              const double       First,
0300                              const double       Last,
0301                              const bool         Only3d = false) const;
0302 
0303   //! Sets the range of the edge on the pcurve on the
0304   //! surface.
0305   Standard_EXPORT void Range(const TopoDS_Edge&               E,
0306                              const occ::handle<Geom_Surface>& S,
0307                              const TopLoc_Location&           L,
0308                              const double                     First,
0309                              const double                     Last) const;
0310 
0311   //! Sets the range of the edge on the pcurve on the face.
0312   void Range(const TopoDS_Edge& E,
0313              const TopoDS_Face& F,
0314              const double       First,
0315              const double       Last) const;
0316 
0317   //! Add to <Eout> the geometric representations of <Ein>.
0318   Standard_EXPORT void Transfert(const TopoDS_Edge& Ein, const TopoDS_Edge& Eout) const;
0319 
0320   //! Makes an udefined vertex without geometry.
0321   void MakeVertex(TopoDS_Vertex& V) const;
0322 
0323   //! Makes a vertex from a 3D point.
0324   void MakeVertex(TopoDS_Vertex& V, const gp_Pnt& P, const double Tol) const;
0325 
0326   //! Sets a 3D point on the vertex.
0327   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& V,
0328                                     const gp_Pnt&        P,
0329                                     const double         Tol) const;
0330 
0331   //! Sets the parameter for the vertex on the edge curves.
0332   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& V,
0333                                     const double         P,
0334                                     const TopoDS_Edge&   E,
0335                                     const double         Tol) const;
0336 
0337   //! Sets the parameter for the vertex on the edge
0338   //! pcurve on the face.
0339   void UpdateVertex(const TopoDS_Vertex& V,
0340                     const double         P,
0341                     const TopoDS_Edge&   E,
0342                     const TopoDS_Face&   F,
0343                     const double         Tol) const;
0344 
0345   //! Sets the parameter for the vertex on the edge
0346   //! pcurve on the surface.
0347   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex&             V,
0348                                     const double                     P,
0349                                     const TopoDS_Edge&               E,
0350                                     const occ::handle<Geom_Surface>& S,
0351                                     const TopLoc_Location&           L,
0352                                     const double                     Tol) const;
0353 
0354   //! Sets the parameters for the vertex on the face.
0355   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& Ve,
0356                                     const double         U,
0357                                     const double         V,
0358                                     const TopoDS_Face&   F,
0359                                     const double         Tol) const;
0360 
0361   //! Updates the vertex tolerance.
0362   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& V, const double Tol) const;
0363 
0364   //! Transfert the parameters of Vin on Ein as the
0365   //! parameter of Vout on Eout.
0366   Standard_EXPORT void Transfert(const TopoDS_Edge&   Ein,
0367                                  const TopoDS_Edge&   Eout,
0368                                  const TopoDS_Vertex& Vin,
0369                                  const TopoDS_Vertex& Vout) const;
0370 };
0371 
0372 #include <BRep_Builder.lxx>
0373 
0374 #endif // _BRep_Builder_HeaderFile