[4805] | 1 | /*! |
---|
| 2 | \file proto_class.h |
---|
[4845] | 3 | * Definition of ... |
---|
[4805] | 4 | |
---|
[4845] | 5 | */ |
---|
[4805] | 6 | |
---|
| 7 | #ifndef _QUADTREE_NODE_H |
---|
| 8 | #define _QUADTREE_NODE_H |
---|
| 9 | |
---|
| 10 | #include "base_object.h" |
---|
[4810] | 11 | #include "vector.h" |
---|
[4845] | 12 | #include "abstract_model.h" |
---|
[4811] | 13 | |
---|
[4805] | 14 | // FORWARD DEFINITION |
---|
[4813] | 15 | class Quadtree; |
---|
[4805] | 16 | |
---|
[4868] | 17 | |
---|
[4805] | 18 | //! A class for a Quadtree Node representation |
---|
| 19 | class QuadtreeNode : public BaseObject { |
---|
| 20 | |
---|
[4845] | 21 | public: |
---|
[4887] | 22 | QuadtreeNode(sTriangleExt** triangles, int numTriangles, |
---|
[4896] | 23 | const float* pVertices, int numVertices, |
---|
[4897] | 24 | Quadtree* quadtree, QuadtreeNode* parent, |
---|
[4900] | 25 | Rectangle* rect, int treeDepth, const int maxDepth, int index); |
---|
[4902] | 26 | QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth); |
---|
[4845] | 27 | virtual ~QuadtreeNode(); |
---|
[4805] | 28 | |
---|
[4911] | 29 | void buildHashTable(QuadtreeNode** nodeList, int* index); |
---|
| 30 | |
---|
[4904] | 31 | float getHeight(const Vector& position); |
---|
| 32 | |
---|
[4845] | 33 | void drawTree(int depth, int drawMode) const; |
---|
[4812] | 34 | |
---|
| 35 | |
---|
[4845] | 36 | private: |
---|
[4852] | 37 | void init(); |
---|
[4805] | 38 | |
---|
[4898] | 39 | void separateNode(float minLength); |
---|
| 40 | void separateNode(); |
---|
| 41 | |
---|
[4897] | 42 | Rectangle* getDimFromModel(); |
---|
[4896] | 43 | |
---|
| 44 | protected: |
---|
| 45 | QuadtreeNode* parent; //!< reference to the paren QuadtreeNode (NULL if rootnode) |
---|
| 46 | QuadtreeNode* nodeA; //!< reference to the node A |
---|
| 47 | QuadtreeNode* nodeB; //!< reference to the node B |
---|
| 48 | QuadtreeNode* nodeC; //!< reference to the node C |
---|
| 49 | QuadtreeNode* nodeD; //!< reference to the node D |
---|
[4907] | 50 | QuadtreeNode** nodes; //!< reference to the quadtree nodes |
---|
[4911] | 51 | int nodeIter; //!< temp helping variable for the hashing algorithm |
---|
[4896] | 52 | |
---|
[4845] | 53 | private: |
---|
| 54 | Quadtree* quadtree; //!< reference to the quadtree |
---|
| 55 | Vector center; //!< center coordinate of the quadtree node - relative coordinates in model space(!) |
---|
| 56 | float axisLength; //!< axis length of the quadtree |
---|
| 57 | float maxHeigth; //!< max height of the model in the quadtree |
---|
[4851] | 58 | float offset; //!< offset of the actual quadtree rectangle |
---|
[4811] | 59 | |
---|
[4887] | 60 | int treeDepth; //!< the depth of the tree |
---|
[4898] | 61 | int maxDepth; //!< the maximal depth of the tree |
---|
[4900] | 62 | int indexNode; //!< the index number of the node |
---|
[4887] | 63 | |
---|
[4851] | 64 | sTriangleExt** pTriangles; //!< reference to the triangles of the node |
---|
| 65 | const float* pVertices; //!< reference to vertices data |
---|
[4845] | 66 | unsigned int numTriangles; //!< number of triangles of the Node |
---|
[4868] | 67 | unsigned int numVertices; //!< number of vertices of the node |
---|
[4845] | 68 | modelInfo* pModelInfo; //!< reference to the modelInfo of the object |
---|
[4851] | 69 | Rectangle* pDimension; //!< pointer to the local rectangle properties |
---|
[4805] | 70 | }; |
---|
| 71 | |
---|
| 72 | #endif /* _QUADTREE_NODE_H */ |
---|