00001 00012 #ifndef __INDEX_OCT_H__ 00013 #define __INDEX_OCT_H__ 00014 00015 #include <octree/oct_struct.h> 00016 #include <node_index.h> 00017 #include <polygon.h> 00018 00019 #include <exception.h> 00020 00024 const Axis AXIS_PARTS = 2; 00025 00033 class IndexOct : public OctStruct { 00034 public: 00041 IndexOct(Hight maxTreeHight) throw(NotEnoughMemoryException*); 00042 00052 void add(NodeIndex p, Color color) throw (NotEnoughMemoryException*); 00053 00063 void add(Surface* s, Color color) throw (NotEnoughMemoryException*); 00064 00072 bool exist(NodeIndex p); 00073 00081 NodeIndex getChild(NodeIndex parent, PartType i); 00082 00090 Color getColor(NodeIndex p); 00091 00101 NodeIndex getExistNode(NodeIndex p); 00102 00107 Hight getMaxTreeHight(); 00108 00117 static AxIndex getPartOfs(PartType partNumber, Axis axis); 00118 00125 bool isLeaf(NodeIndex p); 00126 00135 bool isIn(NodeIndex p); 00136 00145 void setColor(NodeIndex p, Color color); 00146 00147 protected: 00158 Hight getExistNode(NodeIndex p, _octree &subtree); 00159 00168 bool isIn(NodeIndex p, Hight h); 00169 00170 #ifdef MARK_BORDER 00171 00178 void setBorderColor(NodeIndex p, Color color); 00179 #endif 00180 00181 private: 00197 void add(_octree parent, NodeIndex myIdx, Surface* s, Color color) 00198 throw (NotEnoughMemoryException*); 00199 00207 PartType getPart(AxIndex idx, Hight h); 00208 00216 PartType getPart(NodeIndex p, Hight h); 00217 00221 Hight rootHight; 00222 }; 00223 00224 #endif // ! __INDEX_OCT_H__