Changeset 4614 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 13, 2005, 12:57:53 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/collision_detection
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4613 r4614 64 64 /** 65 65 \brief creates a new BVTree or BVTree partition 66 \param depth: the depth of the tree66 \param depth: how much more depth-steps to go: if == 1 don't go any deeper! 67 67 \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle 68 68 */ 69 69 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length) 70 70 { 71 this->bvElement = this->createBox(); 72 this->calculateBoxAttributes(this->bvElement, verticesList, length); 73 this->forkBox(this->bvElement); 71 this->depth = depth; 72 73 if( likely( this->depth > 0)) 74 { 75 this->bvElement = this->createBox(); 76 this->calculateBoxAttributes(this->bvElement, verticesList, length); 77 this->forkBox(this->bvElement); 78 } 74 79 } 75 80 … … 366 371 } 367 372 373 /* now spawn the obb tree: create the nodes and descent */ 374 OBBTreeNode* node1 = new OBBTreeNode(); 375 OBBTreeNode* node2 = new OBBTreeNode(); 376 377 this->nodeLeft = node1; 378 this->nodeRight = node2; 379 380 this->nodeLeft->spawnBVTree(this->depth - 1, vertList1, partition1.getSize()); 381 this->nodeRight->spawnBVTree(this->depth - 1, vertList2, partition2.getSize()); 368 382 } 369 383 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.h
r4568 r4614 1 /*! 1 /*! 2 2 \file bv_tree.h 3 3 \brief Definition of a bounding volume tree 4 4 5 */5 */ 6 6 7 7 #ifndef _OBB_TREE_NODE_H … … 21 21 22 22 23 public:24 OBBTreeNode();25 virtual ~OBBTreeNode();23 public: 24 OBBTreeNode(); 25 virtual ~OBBTreeNode(); 26 26 27 virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);27 virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length); 28 28 29 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }30 inline const int getIndex() { return this->treeIndex; }29 BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; } 30 inline const int getIndex() { return this->treeIndex; } 31 31 32 virtual void collideWith(const BVTree &tree);32 virtual void collideWith(const BVTree &tree); 33 33 34 virtual void drawBV(int currentDepth, const int depth) const;35 virtual void drawBVPolygon(int currentDepth, const int depth) const;36 virtual void drawBVBlended(int currentDepth, const int depth) const;34 virtual void drawBV(int currentDepth, const int depth) const; 35 virtual void drawBVPolygon(int currentDepth, const int depth) const; 36 virtual void drawBVBlended(int currentDepth, const int depth) const; 37 37 38 void debug();38 void debug(); 39 39 40 private: 41 OBB* createBox(); 42 void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length); 43 void forkBox(OBB* box); 44 45 46 protected: 47 OBB* bvElement; 48 OBBTreeNode* nodeLeft; 49 OBBTreeNode* nodeRight; 40 private: 41 OBB* createBox(); 42 void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length); 43 void forkBox(OBB* box); 50 44 51 45 52 private: 53 unsigned int treeIndex; //!< Index number of the BV in the tree 54 sVec3D* vertices; //!< pointer to the vertices data 55 int numOfVertices; //!< number of vertices in vertices data 46 protected: 47 OBB* bvElement; //!< the obb element 48 OBBTreeNode* nodeLeft; //!< ref to the left tree node 49 OBBTreeNode* nodeRight; //!< ref to the right tree node 50 51 52 private: 53 unsigned int treeIndex; //!< Index number of the BV in the tree 54 sVec3D* vertices; //!< pointer to the vertices data 55 int numOfVertices; //!< number of vertices in vertices data 56 int depth; //!< the depth of the node in the tree 56 57 57 58 };
Note: See TracChangeset
for help on using the changeset viewer.