00001
00031 #ifndef LL_LLPLANE_H
00032 #define LL_LLPLANE_H
00033
00034 #include "v3math.h"
00035 #include "v4math.h"
00036
00037
00038
00039
00040
00041
00042
00043
00044 class LLPlane : public LLVector4
00045 {
00046 public:
00047 LLPlane() {};
00048 LLPlane(const LLVector3 &p0, F32 d) { setVec(p0, d); }
00049 LLPlane(const LLVector3 &p0, const LLVector3 &n) { setVec(p0, n); }
00050 void setVec(const LLVector3 &p0, F32 d) { LLVector4::setVec(p0[0], p0[1], p0[2], d); }
00051 void setVec(const LLVector3 &p0, const LLVector3 &n)
00052 {
00053 F32 d = -(p0 * n);
00054 setVec(n, d);
00055 }
00056 void setVec(const LLVector3 &p0, const LLVector3 &p1, const LLVector3 &p2)
00057 {
00058 LLVector3 u, v, w;
00059 u = p1 - p0;
00060 v = p2 - p0;
00061 w = u % v;
00062 w.normVec();
00063 F32 d = -(w * p0);
00064 setVec(w, d);
00065 }
00066 LLPlane& operator=(const LLVector4& v2) { LLVector4::setVec(v2[0],v2[1],v2[2],v2[3]); return *this;}
00067 F32 dist(const LLVector3 &v2) const { return mV[0]*v2[0] + mV[1]*v2[1] + mV[2]*v2[2] + mV[3]; }
00068 };
00069
00070
00071
00072 #endif // LL_LLPLANE_H