/*! \file proto_class.h * Definition of ... */ #ifndef _QUADTREE_NODE_H #define _QUADTREE_NODE_H #include "base_object.h" #include "vector.h" #include "abstract_model.h" // FORWARD DEFINITION class Quadtree; //! A class for a Quadtree Node representation class QuadtreeNode : public BaseObject { public: QuadtreeNode(sTriangleExt** triangles, int numTriangles, const float* pVertices, int numVertices, Quadtree* quadtree, QuadtreeNode* parent, Rectangle* rect, int treeDepth, const int maxDepth, int index); QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth); virtual ~QuadtreeNode(); void buildHashTable(QuadtreeNode** nodeList, int* index); float getHeight(const Vector& position); Rectangle* getDimension() { return this->pDimension; } void drawTree(int depth, int drawMode) const; private: void init(); void separateNode(float minLength); void separateNode(); Rectangle* getDimFromModel(); protected: QuadtreeNode* parent; //!< reference to the paren QuadtreeNode (NULL if rootnode) QuadtreeNode* nodeA; //!< reference to the node A QuadtreeNode* nodeB; //!< reference to the node B QuadtreeNode* nodeC; //!< reference to the node C QuadtreeNode* nodeD; //!< reference to the node D QuadtreeNode** nodes; //!< reference to the quadtree nodes int nodeIter; //!< temp helping variable for the hashing algorithm private: Quadtree* quadtree; //!< reference to the quadtree Vector center; //!< center coordinate of the quadtree node - relative coordinates in model space(!) float axisLength; //!< axis length of the quadtree float maxHeigth; //!< max height of the model in the quadtree float offset; //!< offset of the actual quadtree rectangle int treeDepth; //!< the depth of the tree int maxDepth; //!< the maximal depth of the tree int indexNode; //!< the index number of the node sTriangleExt** pTriangles; //!< reference to the triangles of the node const float* pVertices; //!< reference to vertices data unsigned int numTriangles; //!< number of triangles of the Node unsigned int numVertices; //!< number of vertices of the node modelInfo* pModelInfo; //!< reference to the modelInfo of the object Rectangle* pDimension; //!< pointer to the local rectangle properties }; #endif /* _QUADTREE_NODE_H */