Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-06 08:35:35

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_ListOfTriangulation.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 Handle(Geom_Surface)& S,
0068                                 const Standard_Real         Tol) const;
0069 
0070   //! Makes a Face with a surface and a location.
0071   Standard_EXPORT void MakeFace(TopoDS_Face&                F,
0072                                 const Handle(Geom_Surface)& S,
0073                                 const TopLoc_Location&      L,
0074                                 const Standard_Real         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 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 Poly_ListOfTriangulation&   theTriangulations,
0087     const Handle(Poly_Triangulation)& theActiveTriangulation = Handle(Poly_Triangulation)()) const;
0088 
0089   //! Updates the face F using the tolerance value Tol,
0090   //! surface S and location Location.
0091   Standard_EXPORT void UpdateFace(const TopoDS_Face&          F,
0092                                   const Handle(Geom_Surface)& S,
0093                                   const TopLoc_Location&      L,
0094                                   const Standard_Real         Tol) const;
0095 
0096   //! Changes a face triangulation.
0097   //! A NULL theTriangulation removes face triangulations.
0098   //! If theToReset is TRUE face triangulations will be reset to new list with only one input
0099   //! triangulation that will be active. Else if theTriangulation is contained in internal
0100   //! triangulations list it will be made active,
0101   //!      else the active triangulation will be replaced to theTriangulation one.
0102   Standard_EXPORT void UpdateFace(const TopoDS_Face&                theFace,
0103                                   const Handle(Poly_Triangulation)& theTriangulation,
0104                                   const Standard_Boolean            theToReset = true) const;
0105 
0106   //! Updates the face Tolerance.
0107   Standard_EXPORT void UpdateFace(const TopoDS_Face& F, const Standard_Real Tol) const;
0108 
0109   //! Sets the  NaturalRestriction flag of  the face.
0110   Standard_EXPORT void NaturalRestriction(const TopoDS_Face& F, const Standard_Boolean N) const;
0111 
0112   //! Makes an undefined Edge (no geometry).
0113   Standard_EXPORT void MakeEdge(TopoDS_Edge& E) const;
0114 
0115   //! Makes an Edge with a curve.
0116   void MakeEdge(TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
0117 
0118   //! Makes an Edge with a curve and a location.
0119   void MakeEdge(TopoDS_Edge&              E,
0120                 const Handle(Geom_Curve)& C,
0121                 const TopLoc_Location&    L,
0122                 const Standard_Real       Tol) const;
0123 
0124   //! Makes an Edge with a polygon 3d.
0125   void MakeEdge(TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
0126 
0127   //! makes an Edge polygon on Triangulation.
0128   void MakeEdge(TopoDS_Edge&                               E,
0129                 const Handle(Poly_PolygonOnTriangulation)& N,
0130                 const Handle(Poly_Triangulation)&          T) const;
0131 
0132   //! makes an Edge polygon on Triangulation.
0133   void MakeEdge(TopoDS_Edge&                               E,
0134                 const Handle(Poly_PolygonOnTriangulation)& N,
0135                 const Handle(Poly_Triangulation)&          T,
0136                 const TopLoc_Location&                     L) const;
0137 
0138   //! Sets a 3D curve for the edge.
0139   //! If <C> is a null handle, remove any existing 3d curve.
0140   void UpdateEdge(const TopoDS_Edge& E, const Handle(Geom_Curve)& C, const Standard_Real Tol) const;
0141 
0142   //! Sets a 3D curve for the edge.
0143   //! If <C> is a null handle, remove any existing 3d curve.
0144   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&        E,
0145                                   const Handle(Geom_Curve)& C,
0146                                   const TopLoc_Location&    L,
0147                                   const Standard_Real       Tol) const;
0148 
0149   //! Sets a pcurve for the edge on the face.
0150   //! If <C> is a null handle, remove any existing pcurve.
0151   void UpdateEdge(const TopoDS_Edge&          E,
0152                   const Handle(Geom2d_Curve)& C,
0153                   const TopoDS_Face&          F,
0154                   const Standard_Real         Tol) const;
0155 
0156   //! Sets pcurves for the edge on the  closed face.  If
0157   //! <C1> or <C2> is a null handle, remove any existing
0158   //! pcurve.
0159   void UpdateEdge(const TopoDS_Edge&          E,
0160                   const Handle(Geom2d_Curve)& C1,
0161                   const Handle(Geom2d_Curve)& C2,
0162                   const TopoDS_Face&          F,
0163                   const Standard_Real         Tol) const;
0164 
0165   //! Sets a pcurve for the edge on the face.
0166   //! If <C> is a null handle, remove any existing pcurve.
0167   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&          E,
0168                                   const Handle(Geom2d_Curve)& C,
0169                                   const Handle(Geom_Surface)& S,
0170                                   const TopLoc_Location&      L,
0171                                   const Standard_Real         Tol) const;
0172 
0173   //! Sets a pcurve for the edge on the face.
0174   //! If <C> is a null handle, remove any existing pcurve.
0175   //! Sets UV bounds for curve repsentation
0176   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&          E,
0177                                   const Handle(Geom2d_Curve)& C,
0178                                   const Handle(Geom_Surface)& S,
0179                                   const TopLoc_Location&      L,
0180                                   const Standard_Real         Tol,
0181                                   const gp_Pnt2d&             Pf,
0182                                   const gp_Pnt2d&             Pl) const;
0183 
0184   //! Sets pcurves for the edge on the closed surface.
0185   //! <C1> or <C2> is a null handle, remove any existing
0186   //! pcurve.
0187   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&          E,
0188                                   const Handle(Geom2d_Curve)& C1,
0189                                   const Handle(Geom2d_Curve)& C2,
0190                                   const Handle(Geom_Surface)& S,
0191                                   const TopLoc_Location&      L,
0192                                   const Standard_Real         Tol) const;
0193 
0194   //! Sets pcurves for the edge on the closed surface.
0195   //! <C1> or <C2> is a null handle, remove any existing
0196   //! pcurve.
0197   //! Sets UV bounds for curve repsentation
0198   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&          E,
0199                                   const Handle(Geom2d_Curve)& C1,
0200                                   const Handle(Geom2d_Curve)& C2,
0201                                   const Handle(Geom_Surface)& S,
0202                                   const TopLoc_Location&      L,
0203                                   const Standard_Real         Tol,
0204                                   const gp_Pnt2d&             Pf,
0205                                   const gp_Pnt2d&             Pl) const;
0206 
0207   //! Changes an Edge 3D polygon.
0208   //! A null Polygon removes the 3d Polygon.
0209   void UpdateEdge(const TopoDS_Edge& E, const Handle(Poly_Polygon3D)& P) const;
0210 
0211   //! Changes an Edge 3D polygon.
0212   //! A null Polygon removes the 3d Polygon.
0213   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&            E,
0214                                   const Handle(Poly_Polygon3D)& P,
0215                                   const TopLoc_Location&        L) const;
0216 
0217   //! Changes an Edge polygon on Triangulation.
0218   void UpdateEdge(const TopoDS_Edge&                         E,
0219                   const Handle(Poly_PolygonOnTriangulation)& N,
0220                   const Handle(Poly_Triangulation)&          T) const;
0221 
0222   //! Changes an Edge polygon on Triangulation.
0223   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                         E,
0224                                   const Handle(Poly_PolygonOnTriangulation)& N,
0225                                   const Handle(Poly_Triangulation)&          T,
0226                                   const TopLoc_Location&                     L) const;
0227 
0228   //! Changes an Edge polygon on Triangulation.
0229   void UpdateEdge(const TopoDS_Edge&                         E,
0230                   const Handle(Poly_PolygonOnTriangulation)& N1,
0231                   const Handle(Poly_PolygonOnTriangulation)& N2,
0232                   const Handle(Poly_Triangulation)&          T) const;
0233 
0234   //! Changes an Edge polygon on Triangulation.
0235   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&                         E,
0236                                   const Handle(Poly_PolygonOnTriangulation)& N1,
0237                                   const Handle(Poly_PolygonOnTriangulation)& N2,
0238                                   const Handle(Poly_Triangulation)&          T,
0239                                   const TopLoc_Location&                     L) const;
0240 
0241   //! Changes Edge polygon on a face.
0242   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&            E,
0243                                   const Handle(Poly_Polygon2D)& P,
0244                                   const TopoDS_Face&            S) const;
0245 
0246   //! Changes Edge polygon on a face.
0247   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&            E,
0248                                   const Handle(Poly_Polygon2D)& P,
0249                                   const Handle(Geom_Surface)&   S,
0250                                   const TopLoc_Location&        T) const;
0251 
0252   //! Changes Edge polygons on a face.
0253   //!
0254   //! A null Polygon removes the 2d Polygon.
0255   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&            E,
0256                                   const Handle(Poly_Polygon2D)& P1,
0257                                   const Handle(Poly_Polygon2D)& P2,
0258                                   const TopoDS_Face&            S) const;
0259 
0260   //! Changes Edge polygons on a face.
0261   //!
0262   //! A null Polygon removes the 2d Polygon.
0263   Standard_EXPORT void UpdateEdge(const TopoDS_Edge&            E,
0264                                   const Handle(Poly_Polygon2D)& P1,
0265                                   const Handle(Poly_Polygon2D)& P2,
0266                                   const Handle(Geom_Surface)&   S,
0267                                   const TopLoc_Location&        L) const;
0268 
0269   //! Updates the edge tolerance.
0270   Standard_EXPORT void UpdateEdge(const TopoDS_Edge& E, const Standard_Real Tol) const;
0271 
0272   //! Sets the geometric continuity on the edge.
0273   Standard_EXPORT void Continuity(const TopoDS_Edge&  E,
0274                                   const TopoDS_Face&  F1,
0275                                   const TopoDS_Face&  F2,
0276                                   const GeomAbs_Shape C) const;
0277 
0278   //! Sets the geometric continuity on the edge.
0279   Standard_EXPORT void Continuity(const TopoDS_Edge&          E,
0280                                   const Handle(Geom_Surface)& S1,
0281                                   const Handle(Geom_Surface)& S2,
0282                                   const TopLoc_Location&      L1,
0283                                   const TopLoc_Location&      L2,
0284                                   const GeomAbs_Shape         C) const;
0285 
0286   //! Sets the same parameter flag for the edge <E>.
0287   Standard_EXPORT void SameParameter(const TopoDS_Edge& E, const Standard_Boolean S) const;
0288 
0289   //! Sets the same range flag for the edge <E>.
0290   Standard_EXPORT void SameRange(const TopoDS_Edge& E, const Standard_Boolean S) const;
0291 
0292   //! Sets the degenerated flag for the edge <E>.
0293   Standard_EXPORT void Degenerated(const TopoDS_Edge& E, const Standard_Boolean D) const;
0294 
0295   //! Sets the range of the 3d curve if Only3d=TRUE,
0296   //! otherwise sets the range to all the representations
0297   Standard_EXPORT void Range(const TopoDS_Edge&     E,
0298                              const Standard_Real    First,
0299                              const Standard_Real    Last,
0300                              const Standard_Boolean Only3d = Standard_False) const;
0301 
0302   //! Sets the range  of the edge  on the pcurve on  the
0303   //! surface.
0304   Standard_EXPORT void Range(const TopoDS_Edge&          E,
0305                              const Handle(Geom_Surface)& S,
0306                              const TopLoc_Location&      L,
0307                              const Standard_Real         First,
0308                              const Standard_Real         Last) const;
0309 
0310   //! Sets the range of the edge on the pcurve on the face.
0311   void Range(const TopoDS_Edge&  E,
0312              const TopoDS_Face&  F,
0313              const Standard_Real First,
0314              const Standard_Real Last) const;
0315 
0316   //! Add  to <Eout>  the  geometric representations  of
0317   //! <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 Standard_Real 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 Standard_Real  Tol) const;
0330 
0331   //! Sets  the parameter  for the   vertex on the  edge
0332   //! curves.
0333   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& V,
0334                                     const Standard_Real  P,
0335                                     const TopoDS_Edge&   E,
0336                                     const Standard_Real  Tol) const;
0337 
0338   //! Sets  the parameter  for the  vertex  on the  edge
0339   //! pcurve  on the face.
0340   void UpdateVertex(const TopoDS_Vertex& V,
0341                     const Standard_Real  P,
0342                     const TopoDS_Edge&   E,
0343                     const TopoDS_Face&   F,
0344                     const Standard_Real  Tol) const;
0345 
0346   //! Sets  the parameter  for the  vertex  on the  edge
0347   //! pcurve  on the surface.
0348   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex&        V,
0349                                     const Standard_Real         P,
0350                                     const TopoDS_Edge&          E,
0351                                     const Handle(Geom_Surface)& S,
0352                                     const TopLoc_Location&      L,
0353                                     const Standard_Real         Tol) const;
0354 
0355   //! Sets the parameters for the vertex on the face.
0356   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& Ve,
0357                                     const Standard_Real  U,
0358                                     const Standard_Real  V,
0359                                     const TopoDS_Face&   F,
0360                                     const Standard_Real  Tol) const;
0361 
0362   //! Updates the vertex tolerance.
0363   Standard_EXPORT void UpdateVertex(const TopoDS_Vertex& V, const Standard_Real Tol) const;
0364 
0365   //! Transfert the parameters  of   Vin on  Ein as  the
0366   //! parameter of Vout on Eout.
0367   Standard_EXPORT void Transfert(const TopoDS_Edge&   Ein,
0368                                  const TopoDS_Edge&   Eout,
0369                                  const TopoDS_Vertex& Vin,
0370                                  const TopoDS_Vertex& Vout) const;
0371 
0372 protected:
0373 private:
0374 };
0375 
0376 #include <BRep_Builder.lxx>
0377 
0378 #endif // _BRep_Builder_HeaderFile