Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:16:48

0001 // Created on: 1993-07-12
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-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 _BRepLib_MakeFace_HeaderFile
0018 #define _BRepLib_MakeFace_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepLib_FaceError.hxx>
0025 #include <BRepLib_MakeShape.hxx>
0026 class TopoDS_Face;
0027 class gp_Pln;
0028 class gp_Cylinder;
0029 class gp_Cone;
0030 class gp_Sphere;
0031 class gp_Torus;
0032 class Geom_Surface;
0033 class TopoDS_Wire;
0034 class Geom_Curve;
0035 
0036 //! Provides methods to build faces.
0037 //!
0038 //! A face may be built :
0039 //!
0040 //! * From a surface.
0041 //!
0042 //! - Elementary surface from gp.
0043 //!
0044 //! - Surface from Geom.
0045 //!
0046 //! * From a surface and U,V values.
0047 //!
0048 //! * From a wire.
0049 //!
0050 //! - Find the surface automatically if possible.
0051 //!
0052 //! * From a surface and a wire.
0053 //!
0054 //! - A flag Inside is given, when this flag is True
0055 //! the wire is oriented to bound a finite area on
0056 //! the surface.
0057 //!
0058 //! * From a face and a wire.
0059 //!
0060 //! - The new wire is a perforation.
0061 class BRepLib_MakeFace : public BRepLib_MakeShape
0062 {
0063 public:
0064   DEFINE_STANDARD_ALLOC
0065 
0066   //! Not done.
0067   Standard_EXPORT BRepLib_MakeFace();
0068 
0069   //! Load a face. Useful to add wires.
0070   Standard_EXPORT BRepLib_MakeFace(const TopoDS_Face& F);
0071 
0072   //! Make a face from a plane.
0073   Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P);
0074 
0075   //! Make a face from a cylinder.
0076   Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C);
0077 
0078   //! Make a face from a cone.
0079   Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C);
0080 
0081   //! Make a face from a sphere.
0082   Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S);
0083 
0084   //! Make a face from a torus.
0085   Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C);
0086 
0087   //! Make a face from a Surface. Accepts tolerance value (TolDegen)
0088   //! for resolution of degenerated edges.
0089   Standard_EXPORT BRepLib_MakeFace(const occ::handle<Geom_Surface>& S, const double TolDegen);
0090 
0091   //! Make a face from a plane.
0092   Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P,
0093                                    const double  UMin,
0094                                    const double  UMax,
0095                                    const double  VMin,
0096                                    const double  VMax);
0097 
0098   //! Make a face from a cylinder.
0099   Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C,
0100                                    const double       UMin,
0101                                    const double       UMax,
0102                                    const double       VMin,
0103                                    const double       VMax);
0104 
0105   //! Make a face from a cone.
0106   Standard_EXPORT BRepLib_MakeFace(const gp_Cone& C,
0107                                    const double   UMin,
0108                                    const double   UMax,
0109                                    const double   VMin,
0110                                    const double   VMax);
0111 
0112   //! Make a face from a sphere.
0113   Standard_EXPORT BRepLib_MakeFace(const gp_Sphere& S,
0114                                    const double     UMin,
0115                                    const double     UMax,
0116                                    const double     VMin,
0117                                    const double     VMax);
0118 
0119   //! Make a face from a torus.
0120   Standard_EXPORT BRepLib_MakeFace(const gp_Torus& C,
0121                                    const double    UMin,
0122                                    const double    UMax,
0123                                    const double    VMin,
0124                                    const double    VMax);
0125 
0126   //! Make a face from a Surface. Accepts min & max parameters
0127   //! to construct the face's bounds. Also accepts tolerance value (TolDegen)
0128   //! for resolution of degenerated edges.
0129   Standard_EXPORT BRepLib_MakeFace(const occ::handle<Geom_Surface>& S,
0130                                    const double                     UMin,
0131                                    const double                     UMax,
0132                                    const double                     VMin,
0133                                    const double                     VMax,
0134                                    const double                     TolDegen);
0135 
0136   //! Find a surface from the wire and make a face.
0137   //! if <OnlyPlane> is true, the computed surface will be
0138   //! a plane. If it is not possible to find a plane, the
0139   //! flag NotDone will be set.
0140   Standard_EXPORT BRepLib_MakeFace(const TopoDS_Wire& W, const bool OnlyPlane = false);
0141 
0142   //! Make a face from a plane and a wire.
0143   Standard_EXPORT BRepLib_MakeFace(const gp_Pln& P, const TopoDS_Wire& W, const bool Inside = true);
0144 
0145   //! Make a face from a cylinder and a wire.
0146   Standard_EXPORT BRepLib_MakeFace(const gp_Cylinder& C,
0147                                    const TopoDS_Wire& W,
0148                                    const bool         Inside = true);
0149 
0150   //! Make a face from a cone and a wire.
0151   Standard_EXPORT BRepLib_MakeFace(const gp_Cone&     C,
0152                                    const TopoDS_Wire& W,
0153                                    const bool         Inside = true);
0154 
0155   //! Make a face from a sphere and a wire.
0156   Standard_EXPORT BRepLib_MakeFace(const gp_Sphere&   S,
0157                                    const TopoDS_Wire& W,
0158                                    const bool         Inside = true);
0159 
0160   //! Make a face from a torus and a wire.
0161   Standard_EXPORT BRepLib_MakeFace(const gp_Torus&    C,
0162                                    const TopoDS_Wire& W,
0163                                    const bool         Inside = true);
0164 
0165   //! Make a face from a Surface and a wire.
0166   Standard_EXPORT BRepLib_MakeFace(const occ::handle<Geom_Surface>& S,
0167                                    const TopoDS_Wire&               W,
0168                                    const bool                       Inside = true);
0169 
0170   //! Adds the wire <W> in the face <F>
0171   Standard_EXPORT BRepLib_MakeFace(const TopoDS_Face& F, const TopoDS_Wire& W);
0172 
0173   //! Load the face.
0174   Standard_EXPORT void Init(const TopoDS_Face& F);
0175 
0176   //! Creates the face from the surface. If Bound is
0177   //! True a wire is made from the natural bounds.
0178   //! Accepts tolerance value (TolDegen) for resolution
0179   //! of degenerated edges.
0180   Standard_EXPORT void Init(const occ::handle<Geom_Surface>& S,
0181                             const bool                       Bound,
0182                             const double                     TolDegen);
0183 
0184   //! Creates the face from the surface and the min-max
0185   //! values. Accepts tolerance value (TolDegen) for resolution
0186   //! of degenerated edges.
0187   Standard_EXPORT void Init(const occ::handle<Geom_Surface>& S,
0188                             const double                     UMin,
0189                             const double                     UMax,
0190                             const double                     VMin,
0191                             const double                     VMax,
0192                             const double                     TolDegen);
0193 
0194   //! Adds the wire <W> in the current face.
0195   Standard_EXPORT void Add(const TopoDS_Wire& W);
0196 
0197   Standard_EXPORT BRepLib_FaceError Error() const;
0198 
0199   //! Returns the new face.
0200   Standard_EXPORT const TopoDS_Face& Face() const;
0201   Standard_EXPORT                    operator TopoDS_Face() const;
0202 
0203   //! Checks the specified curve is degenerated
0204   //! according to specified tolerance.
0205   //! Returns <theActTol> less than <theMaxTol>, which shows
0206   //! actual tolerance to decide the curve is degenerated.
0207   //! Warning: For internal use of BRepLib_MakeFace and BRepLib_MakeShell.
0208   Standard_EXPORT static bool IsDegenerated(const occ::handle<Geom_Curve>& theCurve,
0209                                             const double                   theMaxTol,
0210                                             double&                        theActTol);
0211 
0212 private:
0213   //! Reorient the current face if the boundary is not
0214   //! finite.
0215   Standard_EXPORT void CheckInside();
0216 
0217   BRepLib_FaceError myError;
0218 };
0219 
0220 #endif // _BRepLib_MakeFace_HeaderFile