Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: some very little cleanup in the World - make it a better place

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    Rectangle* getDimension() { return this->pDimension; }
33
34    void drawTree(int depth, int drawMode) const;
35
36
37  private:
38    void init();
39
40    void separateNode(float minLength);
41    void separateNode();
42
43    Rectangle* getDimFromModel();
44
45  protected:
46    QuadtreeNode*                   parent;             //!< reference to the paren QuadtreeNode (NULL if rootnode)
47    QuadtreeNode*                   nodeA;              //!< reference to the node A
48    QuadtreeNode*                   nodeB;              //!< reference to the node B
49    QuadtreeNode*                   nodeC;              //!< reference to the node C
50    QuadtreeNode*                   nodeD;              //!< reference to the node D
51    QuadtreeNode**                  nodes;              //!< reference to the quadtree nodes
52    int                             nodeIter;           //!< temp helping variable for the hashing algorithm
53
54  private:
55    Quadtree*                       quadtree;           //!< reference to the quadtree
56    Vector                          center;             //!< center coordinate of the quadtree node - relative coordinates in model space(!)
57    float                           axisLength;         //!< axis length of the quadtree
58    float                           maxHeigth;          //!< max height of the model in the quadtree
59    float                           offset;             //!< offset of the actual quadtree rectangle
60
61    int                             treeDepth;          //!< the depth of the tree
62    int                             maxDepth;           //!< the maximal depth of the tree
63    int                             indexNode;          //!< the index number of the node
64
65    sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
66    const float*                    pVertices;          //!< reference to vertices data
67    unsigned int                    numTriangles;       //!< number of triangles of the Node
68    unsigned int                    numVertices;        //!< number of vertices of the node
69    modelInfo*                      pModelInfo;         //!< reference to the modelInfo of the object
70    Rectangle*                      pDimension;         //!< pointer to the local rectangle properties
71};
72
73#endif /* _QUADTREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.