Changeset 6447 in orxonox.OLD for branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
- Timestamp:
- Jan 9, 2006, 12:39:15 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc
r6140 r6447 11 11 ### File Specific: 12 12 main-programmer: Patrick Boenzli 13 co-programmer: ...14 13 */ 15 14 … … 44 43 * @param depth: the depth of the obb tree to generate 45 44 */ 46 OBBTreeNode::OBBTreeNode (const OBBTree& tree, unsignedint depth)45 OBBTreeNode::OBBTreeNode (const OBBTree& tree, OBBTreeNode* prev, int depth) 47 46 : BVTreeNode() 48 47 { … … 50 49 51 50 this->obbTree = &tree; 51 this->nodePrev = prev; 52 52 this->depth = depth; 53 this->nextID = 0; 53 54 54 55 this->nodeLeft = NULL; … … 64 65 if( OBBTreeNode_sphereObj == NULL) 65 66 OBBTreeNode_sphereObj = gluNewQuadric(); 67 68 /* debug ids */ 69 if( this->nodePrev) 70 this->treeIndex = 100 * this->depth + this->nodePrev->getID(); 71 else 72 this->treeIndex = 0; 66 73 } 67 74 … … 95 102 * on the triangle informations (triangle soup not polygon soup) 96 103 */ 97 void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsignedint length)104 void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length) 98 105 { 99 106 PRINTF(3)("\n==============================Creating OBB Tree Node==================\n"); 100 107 PRINT(3)(" OBB Tree Infos: \n"); 101 PRINT(3)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, t reeIndex, length);108 PRINT(3)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, this->treeIndex, length); 102 109 this->depth = depth; 103 110 … … 107 114 this->bvElement->triangleIndexesLength = length; 108 115 109 /* create the bo xes in three steps */116 /* create the bounding boxes in three steps */ 110 117 this->calculateBoxCovariance(*this->bvElement, modelInf, triangleIndexes, length); 111 118 this->calculateBoxEigenvectors(*this->bvElement, modelInf, triangleIndexes, length); … … 119 126 if( this->triangleIndexLength1 >= 3) 120 127 { 121 this->nodeLeft = new OBBTreeNode(*this->obbTree, depth - 1);128 this->nodeLeft = new OBBTreeNode(*this->obbTree, this, depth - 1); 122 129 this->nodeLeft->spawnBVTree(modelInf, this->triangleIndexList1, this->triangleIndexLength1); 123 130 } 124 131 if( this->triangleIndexLength2 >= 3) 125 132 { 126 this->nodeRight = new OBBTreeNode(*this->obbTree, depth - 1);133 this->nodeRight = new OBBTreeNode(*this->obbTree, this, depth - 1); 127 134 this->nodeRight->spawnBVTree(modelInf, this->triangleIndexList2, this->triangleIndexLength2); 128 135 } … … 139 146 * @param length: the length of the indexes array 140 147 */ 141 void OBBTreeNode::calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsignedint length)148 void OBBTreeNode::calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length) 142 149 { 143 150 float facelet[length]; //!< surface area of the i'th triangle of the convex hull … … 269 276 */ 270 277 void OBBTreeNode::calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf, 271 const int* triangleIndexes, unsignedint length)278 const int* triangleIndexes, int length) 272 279 { 273 280 … … 305 312 * @param length: the length of the indexes array 306 313 */ 307 void OBBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsignedint length)314 void OBBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length) 308 315 { 309 316 … … 448 455 449 456 /* find the center of the box */ 450 451 457 this->separationPlane = Plane(box.axis[longestAxisIndex], box.center); 452 458 this->sepPlaneCenter[0] = box.center.x;
Note: See TracChangeset
for help on using the changeset viewer.