00001 00002 00003 #ifndef PLANE_H 00004 #define PLANE_H 00005 00006 00007 #include "Vector3f.h" 00008 00009 #include <string> 00010 00011 00012 namespace pge { 00013 00014 00015 struct Triangle; 00016 00017 00018 class Plane { 00019 public: 00020 // 00021 // Constructor 00022 // 00024 Plane(void); 00025 00027 Plane(Vector3f a, Vector3f b, Vector3f c); 00028 00030 Plane(Vector3f start, Vector3f u, Vector3f v, int i); 00031 00033 Plane(Vector3f normal, float d); 00034 00036 Plane(Triangle *triangle); 00037 00039 ~Plane(void); 00040 00041 00042 // 00043 // functions 00044 // 00046 float a(void) { 00047 return m_normal.m_v[0]; 00048 } 00049 00051 float b(void) { 00052 return m_normal.m_v[1]; 00053 } 00054 00056 float c(void) { 00057 return m_normal.m_v[2]; 00058 } 00059 00061 float d(void) { 00062 return m_d; 00063 } 00064 00066 bool isPointOnPlane(Vector3f point); 00067 00069 00073 float getDistanceToPoint(Vector3f point); 00074 00076 Vector3f getFootPoint(Vector3f point); 00077 00079 Vector3f getIntersectionPoint(Vector3f lineStart, Vector3f lineEnd); 00080 00082 bool isLineIntersecting(Vector3f lineStart, Vector3f lineEnd); 00083 00085 std::string toString(void); 00086 00087 00088 // 00089 // variables 00090 // 00091 Vector3f m_normal; 00092 float m_d; 00093 }; 00094 }; 00095 00096 #endif