Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: now the right quadtree is selected, position to quadtreeNode mapping works

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