Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-11-02
0002 // Created by: Jing Cheng MEI
0003 // Copyright (c) 1995-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 _BRepBuilderAPI_FindPlane_HeaderFile
0018 #define _BRepBuilderAPI_FindPlane_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 class Geom_Plane;
0025 class TopoDS_Shape;
0026 
0027 //! Describes functions to find the plane in which the edges
0028 //! of a given shape are located.
0029 //! A FindPlane object provides a framework for:
0030 //! -   extracting the edges of a given shape,
0031 //! -   implementing the construction algorithm, and
0032 //! -   consulting the result.
0033 class BRepBuilderAPI_FindPlane
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Initializes an empty algorithm. The function Init is then used to define the shape.
0039   Standard_EXPORT BRepBuilderAPI_FindPlane();
0040 
0041   //! Constructs the plane containing the edges of the shape S.
0042   //! A plane is built only if all the edges are within a distance
0043   //! of less than or equal to tolerance from a planar surface.
0044   //! This tolerance value is equal to the larger of the following two values:
0045   //! -   Tol, where the default value is negative, or
0046   //! -   the largest of the tolerance values assigned to the individual edges of S.
0047   //! Use the function Found to verify that a plane is built.
0048   //! The resulting plane is then retrieved using the function Plane.
0049   Standard_EXPORT BRepBuilderAPI_FindPlane(const TopoDS_Shape& S, const double Tol = -1);
0050 
0051   //! Constructs the plane containing the edges of the shape S.
0052   //! A plane is built only if all the edges are within a distance
0053   //! of less than or equal to tolerance from a planar surface.
0054   //! This tolerance value is equal to the larger of the following two values:
0055   //! -   Tol, where the default value is negative, or
0056   //! -   the largest of the tolerance values assigned to the individual edges of S.
0057   //! Use the function Found to verify that a plane is built.
0058   //! The resulting plane is then retrieved using the function Plane.
0059   Standard_EXPORT void Init(const TopoDS_Shape& S, const double Tol = -1);
0060 
0061   //! Returns true if a plane containing the edges of the
0062   //! shape is found and built. Use the function Plane to consult the result.
0063   Standard_EXPORT bool Found() const;
0064 
0065   //! Returns the plane containing the edges of the shape.
0066   //! Warning
0067   //! Use the function Found to verify that the plane is built. If
0068   //! a plane is not found, Plane returns a null handle.
0069   Standard_EXPORT occ::handle<Geom_Plane> Plane() const;
0070 
0071 private:
0072   occ::handle<Geom_Plane> myPlane;
0073 };
0074 
0075 #endif // _BRepBuilderAPI_FindPlane_HeaderFile