00001 #ifndef EVENT_H 00002 #define EVENT_H 00003 00004 00005 #include "SplitPlane.h" 00006 00007 00008 class Primitive; 00009 00010 00015 enum EventType 00016 { 00017 ET_END = 0, //< Primitive ends on this position 00018 ET_PLANAR = 1, //< Primitive is perpendicular to plane 00019 ET_START = 2 //< Primitive starts on this position 00020 }; 00021 00022 00027 class Event 00028 { 00029 public: 00032 Event() 00033 : mPrimitive(NULL), 00034 mPlane(), 00035 mType(ET_PLANAR) 00036 { 00037 } 00038 00045 Event( Primitive * prim, 00046 const SplitPlane & plane, 00047 EventType eventType ) 00048 : mPrimitive(prim), 00049 mPlane(plane), 00050 mType(eventType) 00051 { 00052 } 00053 00057 bool operator<(const Event & other) const 00058 { 00059 if (this == &other || other.mPlane < mPlane) 00060 return false; 00061 return (mPlane < other.mPlane) || (mType < other.mType); 00062 } 00063 00066 Primitive * primitive() const 00067 { 00068 return mPrimitive; 00069 } 00070 00073 const SplitPlane & plane() const 00074 { 00075 return mPlane; 00076 } 00077 00080 EventType type() const 00081 { 00082 return mType; 00083 } 00084 00085 private: 00087 Primitive * mPrimitive; 00088 00090 SplitPlane mPlane; 00091 00093 EventType mType; 00094 }; 00095 00096 #endif 00097