Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h @ 4911

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

orxonox/trunk: creating lookup table with a very fancy algorithm

File size: 3.0 KB
Line 
1/*!
2    \file proto_class.h
3 *  Definition of ...
4
5 */
6
7#ifndef _QUADTREE_NODE_H
8#define _QUADTREE_NODE_H
9
10#include "base_object.h"
11#include "vector.h"
12#include "abstract_model.h"
13
14// FORWARD DEFINITION
15class Quadtree;
16
17
18//! A class for a Quadtree Node representation
19class QuadtreeNode : public BaseObject {
20
21  public:
22    QuadtreeNode(sTriangleExt** triangles, int numTriangles,
23                 const float* pVertices, int numVertices,
24                 Quadtree* quadtree, QuadtreeNode* parent,
25                 Rectangle* rect, int treeDepth, const int maxDepth, int index);
26    QuadtreeNode(modelInfo* pModelInfo, Quadtree* quadtree, const int maxDepth);
27    virtual ~QuadtreeNode();
28
29    void buildHashTable(QuadtreeNode** nodeList, int* index);
30
31    float getHeight(const Vector& position);
32
33    void drawTree(int depth, int drawMode) const;
34
35
36  private:
37    void init();
38
39    void separateNode(float minLength);
40    void separateNode();
41
42    Rectangle* getDimFromModel();
43
44  protected:
45    QuadtreeNode*                   parent;             //!< reference to the paren QuadtreeNode (NULL if rootnode)
46    QuadtreeNode*                   nodeA;              //!< reference to the node A
47    QuadtreeNode*                   nodeB;              //!< reference to the node B
48    QuadtreeNode*                   nodeC;              //!< reference to the node C
49    QuadtreeNode*                   nodeD;              //!< reference to the node D
50    QuadtreeNode**                  nodes;              //!< reference to the quadtree nodes
51    int                             nodeIter;           //!< temp helping variable for the hashing algorithm
52
53  private:
54    Quadtree*                       quadtree;           //!< reference to the quadtree
55    Vector                          center;             //!< center coordinate of the quadtree node - relative coordinates in model space(!)
56    float                           axisLength;         //!< axis length of the quadtree
57    float                           maxHeigth;          //!< max height of the model in the quadtree
58    float                           offset;             //!< offset of the actual quadtree rectangle
59
60    int                             treeDepth;          //!< the depth of the tree
61    int                             maxDepth;           //!< the maximal depth of the tree
62    int                             indexNode;          //!< the index number of the node
63
64    sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
65    const float*                    pVertices;          //!< reference to vertices data
66    unsigned int                    numTriangles;       //!< number of triangles of the Node
67    unsigned int                    numVertices;        //!< number of vertices of the node
68    modelInfo*                      pModelInfo;         //!< reference to the modelInfo of the object
69    Rectangle*                      pDimension;         //!< pointer to the local rectangle properties
70};
71
72#endif /* _QUADTREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.