Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: implemented a point in triangle function

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 "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    sTriangleExt* getTriangleFromPosition(const Vector& position);
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    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.