42cf5bc1 |
1 | // Created on: 1995-11-02 |
2 | // Created by: Jing Cheng MEI |
3 | // Copyright (c) 1995-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 _BRepBuilderAPI_FindPlane_HeaderFile |
18 | #define _BRepBuilderAPI_FindPlane_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <Standard_Real.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | class Geom_Plane; |
27 | class Standard_NoSuchObject; |
28 | class TopoDS_Shape; |
29 | |
30 | |
31 | //! Describes functions to find the plane in which the edges |
32 | //! of a given shape are located. |
33 | //! A FindPlane object provides a framework for: |
34 | //! - extracting the edges of a given shape, |
35 | //! - implementing the construction algorithm, and |
36 | //! - consulting the result. |
37 | class BRepBuilderAPI_FindPlane |
38 | { |
39 | public: |
40 | |
41 | DEFINE_STANDARD_ALLOC |
42 | |
43 | |
44 | //! Initializes an empty algorithm. The function Init is then used to define the shape. |
45 | Standard_EXPORT BRepBuilderAPI_FindPlane(); |
46 | |
47 | //! Constructs the plane containing the edges of the shape S. |
48 | //! A plane is built only if all the edges are within a distance |
49 | //! of less than or equal to tolerance from a planar surface. |
50 | //! This tolerance value is equal to the larger of the following two values: |
51 | //! - Tol, where the default value is negative, or |
52 | //! - the largest of the tolerance values assigned to the individual edges of S. |
53 | //! Use the function Found to verify that a plane is built. |
54 | //! The resulting plane is then retrieved using the function Plane. |
55 | Standard_EXPORT BRepBuilderAPI_FindPlane(const TopoDS_Shape& S, const Standard_Real Tol = -1); |
56 | |
57 | //! Constructs the plane containing the edges of the shape S. |
58 | //! A plane is built only if all the edges are within a distance |
59 | //! of less than or equal to tolerance from a planar surface. |
60 | //! This tolerance value is equal to the larger of the following two values: |
61 | //! - Tol, where the default value is negative, or |
62 | //! - the largest of the tolerance values assigned to the individual edges of S. |
63 | //! Use the function Found to verify that a plane is built. |
64 | //! The resulting plane is then retrieved using the function Plane. |
65 | Standard_EXPORT void Init (const TopoDS_Shape& S, const Standard_Real Tol = -1); |
66 | |
67 | //! Returns true if a plane containing the edges of the |
68 | //! shape is found and built. Use the function Plane to consult the result. |
69 | Standard_EXPORT Standard_Boolean Found() const; |
70 | |
71 | //! Returns the plane containing the edges of the shape. |
72 | //! Warning |
73 | //! Use the function Found to verify that the plane is built. If |
74 | //! a plane is not found, Plane returns a null handle. |
75 | Standard_EXPORT Handle(Geom_Plane) Plane() const; |
76 | |
77 | |
78 | |
79 | |
80 | protected: |
81 | |
82 | |
83 | |
84 | |
85 | |
86 | private: |
87 | |
88 | |
89 | |
90 | Handle(Geom_Plane) myPlane; |
91 | |
92 | |
93 | }; |
94 | |
95 | |
96 | |
97 | |
98 | |
99 | |
100 | |
101 | #endif // _BRepBuilderAPI_FindPlane_HeaderFile |