Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/spatial_separation/quadtree.h @ 4924

Last change on this file since 4924 was 4924, checked in by patrick, 19 years ago

orxonox/trunk: the last cleanups, now the classes look better

File size: 1.7 KB
Line 
1/*!
2    \file quadtree.h
3 *  Definition of a spatial data separation using quadtree
4
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 */
8
9#ifndef _QUADTREE_H
10#define _QUADTREE_H
11
12
13#include "base_object.h"
14#include "abstract_model.h"
15
16
17class QuadtreeNode;
18class Material;
19class Vector;
20
21//! A class for quadtree separation of the world
22class Quadtree : public BaseObject {
23
24
25  public:
26    Quadtree(modelInfo* pModelInfo, const int treeDepth);
27    virtual ~Quadtree();
28
29    QuadtreeNode* getQuadtreeFromPosition(const Vector& position);
30
31    void drawTree() const;
32    inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; }
33
34
35  private:
36    void revertHashTable(QuadtreeNode** nodes);
37    void sortHashTable(QuadtreeNode** nodes);
38
39
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
45
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
49
50    Material**                      materials;             //!< materials for debug drawing purposes
51};
52
53#endif /* _QUADTREE_H */
Note: See TracBrowser for help on using the repository browser.