Last change
on this file since 7912 was
6022,
checked in by bensch, 19 years ago
|
orxonox/trunk: merged the NewModel branche back to the trunk.
merged with command
svn merge branches/newModel/ trunk/ -r 6016:HEAD
no conflicts
|
File size:
1.8 KB
|
Rev | Line | |
---|
[4790] | 1 | /*! |
---|
[5039] | 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" |
---|
[6022] | 14 | #include "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: |
---|
[5430] | 26 | Quadtree(const modelInfo* pModelInfo, const int treeDepth); |
---|
[4924] | 27 | virtual ~Quadtree(); |
---|
[4904] | 28 | |
---|
[4956] | 29 | QuadtreeNode* getQuadtreeFromPosition(const Vector& position) const; |
---|
| 30 | sTriangleExt* getTriangleFromPosition(const Vector& position) const; |
---|
[4901] | 31 | |
---|
[4924] | 32 | void drawTree() const; |
---|
| 33 | inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; } |
---|
| 34 | |
---|
| 35 | |
---|
[4915] | 36 | private: |
---|
| 37 | void revertHashTable(QuadtreeNode** nodes); |
---|
[4920] | 38 | void sortHashTable(QuadtreeNode** nodes); |
---|
[4915] | 39 | |
---|
[4901] | 40 | |
---|
[4924] | 41 | private: |
---|
| 42 | QuadtreeNode* rootNode; //!< reference to the root node of the quadtree |
---|
| 43 | QuadtreeNode** nodes; //!< reference to all quadtree nodes (only leafs of the quad tree) |
---|
[5430] | 44 | const modelInfo* pModelInfo; //!< reference to the modelInfo of the object |
---|
[4924] | 45 | int treeDepth; //!< depth of the tree |
---|
[4922] | 46 | |
---|
[4924] | 47 | float quadLength; //!< length of the leaf quadtree nodes |
---|
| 48 | Vector* offset; //!< vector to the left lower corner of the root quadtree node |
---|
| 49 | int maxIndex; //!< maximal index for the nodes array |
---|
[4907] | 50 | |
---|
[4924] | 51 | Material** materials; //!< materials for debug drawing purposes |
---|
[4790] | 52 | }; |
---|
| 53 | |
---|
| 54 | #endif /* _QUADTREE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.