00001 #ifndef SPLITPLANE_H 00002 #define SPLITPLANE_H 00003 00004 00005 #include "Axis.h" 00006 00007 00012 enum Side 00013 { 00014 S_LEFT = 0, 00015 S_BOTH = 1, 00016 S_RIGHT = 2 00017 }; 00018 00019 00025 class SplitPlane 00026 { 00027 public: 00030 SplitPlane() 00031 : mPosition(INFINITY), 00032 mDirection(NO_AXIS), 00033 mSide(S_BOTH) 00034 { 00035 } 00036 00042 SplitPlane(float pos, Axis dir) 00043 : mPosition(pos), 00044 mDirection(dir), 00045 mSide(S_BOTH) 00046 { 00047 } 00048 00051 bool operator<(const SplitPlane & other) const 00052 { 00053 if (this == &other || mPosition > other.mPosition - EPSILON) 00054 return false; 00055 return (mPosition < other.mPosition - EPSILON) || (mDirection < other.mDirection); 00056 } 00057 00060 float position() const 00061 { 00062 return mPosition; 00063 } 00064 00067 Axis direction() const 00068 { 00069 return mDirection; 00070 } 00071 00074 Side side() const 00075 { 00076 return mSide; 00077 } 00078 00083 void setSide(Side primSide) 00084 { 00085 mSide = primSide; 00086 } 00087 00088 private: 00090 float mPosition; 00091 00093 Axis mDirection; 00094 00096 Side mSide; 00097 }; 00098 00099 #endif 00100