glc_plane.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00023
00024 #ifndef GLC_PLANE_H_
00025 #define GLC_PLANE_H_
00026
00027 #include "glc_vector3d.h"
00028
00029 #include "../glc_config.h"
00030
00033
00036
00037 class GLC_LIB_EXPORT GLC_Plane
00038 {
00040
00042
00043 public:
00045 GLC_Plane();
00046
00048
00049 GLC_Plane(double A, double B, double C, double D);
00050
00052 GLC_Plane(const GLC_Vector3d& normal, double minimumDistance);
00053
00055 GLC_Plane(const GLC_Vector3d& normal, const GLC_Point3d& point);
00056
00058
00059 GLC_Plane(const GLC_Point3d&, const GLC_Point3d&, const GLC_Point3d&);
00060
00062 GLC_Plane(const GLC_Plane&);
00063
00065 GLC_Plane &operator=(const GLC_Plane&);
00066
00068 ~GLC_Plane();
00070
00072
00074
00075 public:
00076
00078 inline double coefA() const
00079 {return m_Eq[0];}
00080
00082 inline double coefB() const
00083 {return m_Eq[1];}
00084
00086 inline double coefC() const
00087 {return m_Eq[2];}
00088
00090 inline double coefD() const
00091 {return m_Eq[3];}
00092
00094 inline double distanceToPoint(const GLC_Point3d& p) const
00095 {return m_Eq[0] * p.x() + m_Eq[1] * p.y() + m_Eq[2] * p.z() + m_Eq[3];}
00096
00098 bool operator==(GLC_Plane) const;
00099
00101 inline bool operator!=(const GLC_Plane& p) const
00102 {return !operator==(p);}
00103
00105 inline GLC_Vector3d normal() const
00106 {return GLC_Vector3d(m_Eq[0], m_Eq[1], m_Eq[2]);}
00107
00109 inline bool lieOnThisPlane(const GLC_Point3d& p)
00110 {return (m_Eq[0] * p.x() + m_Eq[1] * p.y() + m_Eq[2] * p.z() + m_Eq[3]) == 0.0f;}
00111
00113 const double* data() const
00114 {return m_Eq;}
00115
00117 QString toString() const;
00119
00121
00123
00124 public:
00126 inline void setA(double a)
00127 {m_Eq[0]= a;}
00128
00130 inline void setB(double b)
00131 {m_Eq[1]= b;}
00132
00134 inline void setC(double c)
00135 {m_Eq[2]= c;}
00136
00138 inline void setD(double d)
00139 {m_Eq[3]= d;}
00140
00142 void normalize();
00143
00145 GLC_Plane& setPlane(const GLC_Vector3d& normal, const GLC_Point3d& point);
00146
00147
00149
00151
00153 private:
00155 double m_Eq[4];
00156 };
00157
00158 #endif