00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GLPLANE_H
00019 #define GLPLANE_H
00020
00021 #include "glvector.h"
00026 class GLPlane
00027 {
00028 GLVector normal;
00029 GLfloat D;
00030 public:
00031
00032 GLPlane() { normal.set(0,0,0); D = 0; };
00033 GLPlane(GLVector n, GLVector op);
00034 GLPlane(GLVector op1, GLVector op2, GLVector op3);
00035
00036 inline void set( GLVector n, GLVector op)
00037 { normal = n; D = -(normal.dot(op)); }
00038
00039 inline void set( const GLVector& op1, const GLVector& op2, const GLVector& op3 )
00040 { normal = (op3 - op2).getCross( (op1 - op2) ); normal.normalize(); D = -(normal.dot(op1)); }
00041
00042 const GLVector& getNormal(void) const
00043 { return normal; }
00044
00045 inline void setNormal(const GLVector& n)
00046 { normal = n; }
00047
00048 GLfloat distanceToPoint(const GLVector& p) const;
00049 GLfloat intersectionWithLine(GLVector dir, GLVector origin) const;
00050 GLVector reflectedVector(GLVector& in) const;
00051
00052 ~GLPlane();
00053 };
00054
00055 #endif