Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10572 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File size: 1.8 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 "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  ObjectListDeclaration(Quadtree);
24
25  public:
26    Quadtree(const modelInfo* pModelInfo, const int treeDepth);
27    virtual ~Quadtree();
28
29    QuadtreeNode* getQuadtreeFromPosition(const Vector& position) const;
30    sTriangleExt* getTriangleFromPosition(const Vector& position) const;
31
32    void drawTree() const;
33    inline Material* getMaterial(int indexNode) const { return this->materials[indexNode % 4]; }
34
35
36  private:
37    void revertHashTable(QuadtreeNode** nodes);
38    void sortHashTable(QuadtreeNode** nodes);
39
40
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)
44    const modelInfo*                pModelInfo;            //!< reference to the modelInfo of the object
45    int                             treeDepth;             //!< depth of the tree
46
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
50
51    Material**                      materials;             //!< materials for debug drawing purposes
52};
53
54#endif /* _QUADTREE_H */
Note: See TracBrowser for help on using the repository browser.