1 // Created on: 1992-08-26
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 _gce_MakePln_HeaderFile
18 #define _gce_MakePln_HeaderFile
19 
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23 
24 #include <gp_Pln.hxx>
25 #include <gce_Root.hxx>
26 #include <Standard_Real.hxx>
27 class StdFail_NotDone;
28 class gp_Ax2;
29 class gp_Pnt;
30 class gp_Dir;
31 class gp_Pln;
32 class gp_Ax1;
33 
34 
35 //! This class implements the following algorithms used
36 //! to create a Plane from gp.
37 //! * Create a Pln parallel to another and passing
38 //! through a point.
39 //! * Create a Pln passing through 3 points.
40 //! * Create a Pln by its normal.
41 //! Defines a non-persistent plane.
42 //! The plane is located in 3D space with an axis placement
43 //! two axis. It is the local coordinate system of the plane.
44 //!
45 //! The "Location" point and the main direction of this axis
46 //! placement define the "Axis" of the plane. It is the axis
47 //! normal to the plane which gives the orientation of the
48 //! plane.
49 //!
50 //! The "XDirection" and the "YDirection" of the axis
51 //! placement define the plane ("XAxis" and "YAxis") .
52 class gce_MakePln  : public gce_Root
53 {
54 public:
55 
56   DEFINE_STANDARD_ALLOC
57 
58 
59 
60   //! The coordinate system of the plane is defined with the axis
61   //! placement A2.
62   //! The "Direction" of A2 defines the normal to the plane.
63   //! The "Location" of A2 defines the location (origin) of the plane.
64   //! The "XDirection" and "YDirection" of A2 define the "XAxis" and
65   //! the "YAxis" of the plane used to parametrize the plane.
66   Standard_EXPORT gce_MakePln(const gp_Ax2& A2);
67 
68 
69   //! Creates a plane with the  "Location" point <P>
70   //! and the normal direction <V>.
71   Standard_EXPORT gce_MakePln(const gp_Pnt& P, const gp_Dir& V);
72 
73 
74   //! Creates a plane from its cartesian equation :
75   //! A * X + B * Y + C * Z + D = 0.0
76   //!
77   //! the status is "BadEquation" if Sqrt (A*A + B*B + C*C) <=
78   //! Resolution from gp.
79   Standard_EXPORT gce_MakePln(const Standard_Real A, const Standard_Real B, const Standard_Real C, const Standard_Real D);
80 
81   //! Make a Pln from gp <ThePln> parallel to another
82   //! Pln <Pln> and passing through a Pnt <Point>.
83   Standard_EXPORT gce_MakePln(const gp_Pln& Pln, const gp_Pnt& Point);
84 
85   //! Make a Pln from gp <ThePln> parallel to another
86   //! Pln <Pln> at the distance <Dist> which can be greater
87   //! or less than zero.
88   //! In the first case the result is at the distance
89   //! <Dist> to the plane <Pln> in the direction of the
90   //! normal to <Pln>.
91   //! Otherwize it is in the opposite direction.
92   Standard_EXPORT gce_MakePln(const gp_Pln& Pln, const Standard_Real Dist);
93 
94   //! Make a Pln from gp <ThePln> passing through 3
95   //! Pnt <P1>,<P2>,<P3>.
96   //! It returns false if <P1> <P2> <P3> are confused.
97   Standard_EXPORT gce_MakePln(const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3);
98 
99   //! Make a Pln from gp <ThePln> perpendicular to the line
100   //! passing through <P1>,<P2>.
101   //! The status is "ConfusedPoints" if <P1> <P2> are confused.
102   Standard_EXPORT gce_MakePln(const gp_Pnt& P1, const gp_Pnt& P2);
103 
104   //! Make a pln  passing through the location of <Axis>and
105   //! normal to the Direction of <Axis>.
106   //! Warning -  If an error occurs (that is, when IsDone returns
107   //! false), the Status function returns:
108   //! -   gce_BadEquation if Sqrt(A*A + B*B +
109   //! C*C) is less than or equal to gp::Resolution(),
110   //! -   gce_ConfusedPoints if P1 and P2 are coincident, or
111   //! -   gce_ColinearPoints if P1, P2 and P3 are collinear.
112   Standard_EXPORT gce_MakePln(const gp_Ax1& Axis);
113 
114   //! Returns the constructed plane.
115   //! Exceptions StdFail_NotDone if no plane is constructed.
116   Standard_EXPORT const gp_Pln& Value() const;
117 
118   Standard_EXPORT const gp_Pln& Operator() const;
119 Standard_EXPORT operator gp_Pln() const;
120 
121 
122 
123 
124 protected:
125 
126 
127 
128 
129 
130 private:
131 
132 
133 
134   gp_Pln ThePln;
135 
136 
137 };
138 
139 
140 
141 
142 
143 
144 
145 #endif // _gce_MakePln_HeaderFile
146