Last change
on this file since 4925 was
4924,
checked in by patrick, 19 years ago
|
orxonox/trunk: the last cleanups, now the classes look better
|
File size:
1.7 KB
|
Rev | Line | |
---|
[4790] | 1 | /*! |
---|
| 2 | \file quadtree.h |
---|
[4924] | 3 | * Definition of a spatial data separation using quadtree |
---|
[4790] | 4 | |
---|
[4924] | 5 | This is the top element of the quadtree framework. A Quadtree is build of QuadtreeNodes, which are again separated |
---|
| 6 | into QuadtreeNodes until a certain depth is reached |
---|
| 7 | */ |
---|
[4790] | 8 | |
---|
| 9 | #ifndef _QUADTREE_H |
---|
| 10 | #define _QUADTREE_H |
---|
| 11 | |
---|
| 12 | |
---|
[4805] | 13 | #include "base_object.h" |
---|
[4845] | 14 | #include "abstract_model.h" |
---|
[4790] | 15 | |
---|
[4900] | 16 | |
---|
[4810] | 17 | class QuadtreeNode; |
---|
[4900] | 18 | class Material; |
---|
[4904] | 19 | class Vector; |
---|
[4810] | 20 | |
---|
[4790] | 21 | //! A class for quadtree separation of the world |
---|
[4805] | 22 | class Quadtree : public BaseObject { |
---|
[4790] | 23 | |
---|
| 24 | |
---|
[4924] | 25 | public: |
---|
| 26 | Quadtree(modelInfo* pModelInfo, const int treeDepth); |
---|
| 27 | virtual ~Quadtree(); |
---|
[4904] | 28 | |
---|
[4924] | 29 | QuadtreeNode* getQuadtreeFromPosition(const Vector& position); |
---|
[4901] | 30 | |
---|
[4924] | 31 | void drawTree() const; |
---|
| 32 | inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; } |
---|
| 33 | |
---|
| 34 | |
---|
[4915] | 35 | private: |
---|
| 36 | void revertHashTable(QuadtreeNode** nodes); |
---|
[4920] | 37 | void sortHashTable(QuadtreeNode** nodes); |
---|
[4915] | 38 | |
---|
[4901] | 39 | |
---|
[4924] | 40 | private: |
---|
| 41 | QuadtreeNode* rootNode; //!< reference to the root node of the quadtree |
---|
| 42 | QuadtreeNode** nodes; //!< reference to all quadtree nodes (only leafs of the quad tree) |
---|
| 43 | modelInfo* pModelInfo; //!< reference to the modelInfo of the object |
---|
| 44 | int treeDepth; //!< depth of the tree |
---|
[4922] | 45 | |
---|
[4924] | 46 | float quadLength; //!< length of the leaf quadtree nodes |
---|
| 47 | Vector* offset; //!< vector to the left lower corner of the root quadtree node |
---|
| 48 | int maxIndex; //!< maximal index for the nodes array |
---|
[4907] | 49 | |
---|
[4924] | 50 | Material** materials; //!< materials for debug drawing purposes |
---|
[4790] | 51 | }; |
---|
| 52 | |
---|
| 53 | #endif /* _QUADTREE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.