GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_plane.h
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #ifndef GLC_PLANE_H_
25 #define GLC_PLANE_H_
26 
27 #include "glc_vector3d.h"
28 
29 #include "../glc_config.h"
30 
33 
36 
38 {
40 
42 
43 public:
45  GLC_Plane();
46 
48 
49  GLC_Plane(double A, double B, double C, double D);
50 
52  GLC_Plane(const GLC_Vector3d& normal, double minimumDistance);
53 
55  GLC_Plane(const GLC_Vector3d& normal, const GLC_Point3d& point);
56 
58 
59  GLC_Plane(const GLC_Point3d&, const GLC_Point3d&, const GLC_Point3d&);
60 
62  GLC_Plane(const GLC_Plane&);
63 
65  GLC_Plane &operator=(const GLC_Plane&);
66 
68  ~GLC_Plane();
70 
72 
74 
75 public:
76 
78  inline double coefA() const
79  {return m_Eq[0];}
80 
82  inline double coefB() const
83  {return m_Eq[1];}
84 
86  inline double coefC() const
87  {return m_Eq[2];}
88 
90  inline double coefD() const
91  {return m_Eq[3];}
92 
94  inline double distanceToPoint(const GLC_Point3d& p) const
95  {return m_Eq[0] * p.x() + m_Eq[1] * p.y() + m_Eq[2] * p.z() + m_Eq[3];}
96 
98  bool operator==(GLC_Plane) const;
99 
101  inline bool operator!=(const GLC_Plane& p) const
102  {return !operator==(p);}
103 
105  inline GLC_Vector3d normal() const
106  {return GLC_Vector3d(m_Eq[0], m_Eq[1], m_Eq[2]);}
107 
109  bool lieOnThisPlane(const GLC_Point3d& p);
110 
112  const double* data() const
113  {return m_Eq;}
114 
116  QString toString() const;
118 
120 
122 
123 public:
125  inline void setA(double a)
126  {m_Eq[0]= a;}
127 
129  inline void setB(double b)
130  {m_Eq[1]= b;}
131 
133  inline void setC(double c)
134  {m_Eq[2]= c;}
135 
137  inline void setD(double d)
138  {m_Eq[3]= d;}
139 
141  void normalize();
142 
144  GLC_Plane& setPlane(const GLC_Vector3d& normal, const GLC_Point3d& point);
145 
147  GLC_Plane& setNormal(const GLC_Vector3d& normal);
148 
149 
151 
153 // Private Member
155 private:
157  double m_Eq[4];
158 };
159 
160 #endif /* GLC_PLANE_H_ */

©2005-2013 Laurent Ribon