Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/collision_detection/obb_tree_node.h @ 4631

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

orxonox/trunk: the damn segfault is nomore, patrick is on killing spree

File size: 2.2 KB
Line 
1/*!
2    \file bv_tree.h
3    \brief Definition of a bounding volume tree
4
5 */
6
7#ifndef _OBB_TREE_NODE_H
8#define _OBB_TREE_NODE_H
9
10#include "bv_tree_node.h"
11
12
13
14// FORWARD DEFINITION
15class BoundingVolume;
16class OBB;
17class OBBTree;
18//struct sVec3D;
19
20//! A class that represents a bounding volume tree
21class OBBTreeNode : public BVTreeNode {
22
23
24  public:
25    OBBTreeNode();
26    virtual ~OBBTreeNode();
27
28    virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
29
30    BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
31    inline const int getIndex() { return this->treeIndex; }
32    inline void setTreeRef(OBBTree* tree) { this->obbTree = tree;}
33
34    virtual void collideWith(const BVTree &tree);
35
36    virtual void drawBV(int depth) const;
37    virtual void drawBVPolygon(int depth) const;
38    virtual void drawBVBlended(int depth) const;
39
40    void debug();
41
42  private:
43    void calculateBoxAttributes1(OBB* box, sVec3D* verticesList, int length);
44    void calculateBoxAttributes2(OBB* box, sVec3D* verticesList, int length);
45    void calculateBoxAttributes3(OBB* box, sVec3D* verticesList, int length);
46    void forkBox(OBB* box);
47
48
49  protected:
50    OBB* bvElement;                                 //!< the obb element
51    OBBTreeNode* nodeLeft;                          //!< ref to the left tree node
52    OBBTreeNode* nodeRight;                         //!< ref to the right tree node
53
54
55  private:
56    unsigned int        treeIndex;                  //!< Index number of the BV in the tree
57    sVec3D*             vertices;                   //!< pointer to the vertices data
58    int                 numOfVertices;              //!< number of vertices in vertices data
59    int                 depth;                      //!< the depth of the node in the tree
60    static OBBTree*     obbTree;                    //!< reference to the obb tree
61
62    /* tmp saving place for obb variables */
63    sVec3D*             tmpVert1;
64    sVec3D*             tmpVert2;
65    int                 tmpLen1;
66    int                 tmpLen2;
67
68    static float**       coMat;
69    static float**       eigvMat;
70    static float*        eigvlMat;
71    static int*          rotCount;
72};
73
74#endif /* _OBB_TREE_NODE_H */
Note: See TracBrowser for help on using the repository browser.