42cf5bc1 |
1 | // Created on: 1992-09-28 |
2 | // Created by: Remi GILET |
3 | // Copyright (c) 1992-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 _GC_MakePlane_HeaderFile |
18 | #define _GC_MakePlane_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <GC_Root.hxx> |
d1a67b9d |
25 | #include <Geom_Plane.hxx> |
26 | |
42cf5bc1 |
27 | class StdFail_NotDone; |
28 | class gp_Ax2; |
29 | class gp_Pln; |
30 | class gp_Pnt; |
31 | class gp_Dir; |
32 | class gp_Ax1; |
33 | |
34 | |
35 | //! This class implements the following algorithms used |
36 | //! to create a Plane from gp. |
37 | //! * Create a Plane parallel to another and passing |
38 | //! through a point. |
39 | //! * Create a Plane passing through 3 points. |
40 | //! * Create a Plane by its normal |
41 | //! A MakePlane object provides a framework for: |
42 | //! - defining the construction of the plane, |
43 | //! - implementing the construction algorithm, and |
44 | //! - consulting the results. In particular, the Value |
45 | //! function returns the constructed plane. |
46 | class GC_MakePlane : public GC_Root |
47 | { |
48 | public: |
49 | |
50 | DEFINE_STANDARD_ALLOC |
51 | |
42cf5bc1 |
52 | //! Creates a plane from a non persistent plane from package gp. |
53 | Standard_EXPORT GC_MakePlane(const gp_Pln& Pl); |
54 | |
55 | |
56 | //! P is the "Location" point or origin of the plane. |
57 | //! V is the direction normal to the plane. |
58 | Standard_EXPORT GC_MakePlane(const gp_Pnt& P, const gp_Dir& V); |
59 | |
60 | |
61 | //! Creates a plane from its cartesian equation : |
62 | //! Ax + By + Cz + D = 0.0 |
63 | //! Status is "BadEquation" if Sqrt (A*A + B*B + C*C) |
64 | //! <= Resolution from gp |
65 | Standard_EXPORT GC_MakePlane(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D); |
66 | |
67 | //! Make a Plane from Geom <ThePlane> parallel to another |
68 | //! Pln <Pln> and passing through a Pnt <Point>. |
69 | Standard_EXPORT GC_MakePlane(const gp_Pln& Pln, const gp_Pnt& Point); |
70 | |
71 | //! Make a Plane from Geom <ThePlane> parallel to another |
72 | //! Pln <Pln> at the distance <Dist> which can be greater |
73 | //! or lower than zero. |
74 | //! In the first case the result is at the distance |
75 | //! <Dist> to the plane <Pln> in the direction of the |
76 | //! normal to <Pln>. |
77 | //! Otherwize it is in the oposite direction. |
78 | Standard_EXPORT GC_MakePlane(const gp_Pln& Pln, const Standard_Real Dist); |
79 | |
80 | //! Make a Plane from Geom <ThePlane> passing through 3 |
81 | //! Pnt <P1>,<P2>,<P3>. |
82 | //! It returns false if <P1> <P2> <P3> are confused. |
83 | Standard_EXPORT GC_MakePlane(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3); |
84 | |
85 | //! Make a Plane passing through the location of <Axis>and |
86 | //! normal to the Direction of <Axis>. |
87 | Standard_EXPORT GC_MakePlane(const gp_Ax1& Axis); |
88 | |
89 | //! Returns the constructed plane. |
90 | //! Exceptions StdFail_NotDone if no plane is constructed. |
91 | Standard_EXPORT const Handle(Geom_Plane)& Value() const; |
42cf5bc1 |
92 | |
d1a67b9d |
93 | operator const Handle(Geom_Plane)& () const { return Value(); } |
42cf5bc1 |
94 | |
95 | private: |
42cf5bc1 |
96 | Handle(Geom_Plane) ThePlane; |
42cf5bc1 |
97 | }; |
98 | |
42cf5bc1 |
99 | #endif // _GC_MakePlane_HeaderFile |