Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 9, 2006, 12:39:15 AM (18 years ago)
Author:
patrick
Message:

collision: some more debug work on the collision detection framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r6140 r6447  
    1111### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer: ...
    1413*/
    1514
     
    4443 * @param depth: the depth of the obb tree to generate
    4544 */
    46 OBBTreeNode::OBBTreeNode (const OBBTree& tree, unsigned int depth)
     45OBBTreeNode::OBBTreeNode (const OBBTree& tree, OBBTreeNode* prev, int depth)
    4746    : BVTreeNode()
    4847{
     
    5049
    5150  this->obbTree = &tree;
     51  this->nodePrev = prev;
    5252  this->depth = depth;
     53  this->nextID = 0;
    5354
    5455  this->nodeLeft = NULL;
     
    6465  if( OBBTreeNode_sphereObj == NULL)
    6566    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;
    6673}
    6774
     
    95102 * on the triangle informations (triangle soup not polygon soup)
    96103 */
    97 void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length)
     104void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length)
    98105{
    99106  PRINTF(3)("\n==============================Creating OBB Tree Node==================\n");
    100107  PRINT(3)(" OBB Tree Infos: \n");
    101   PRINT(3)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, treeIndex, length);
     108  PRINT(3)("\tDepth: %i \n\tTree Index: %i \n\tNumber of Triangles: %i\n", depth, this->treeIndex, length);
    102109  this->depth = depth;
    103110
     
    107114  this->bvElement->triangleIndexesLength = length;
    108115
    109   /* create the boxes in three steps */
     116  /* create the bounding boxes in three steps */
    110117  this->calculateBoxCovariance(*this->bvElement, modelInf, triangleIndexes, length);
    111118  this->calculateBoxEigenvectors(*this->bvElement, modelInf, triangleIndexes, length);
     
    119126    if( this->triangleIndexLength1 >= 3)
    120127    {
    121       this->nodeLeft = new OBBTreeNode(*this->obbTree, depth - 1);
     128      this->nodeLeft = new OBBTreeNode(*this->obbTree, this, depth - 1);
    122129      this->nodeLeft->spawnBVTree(modelInf, this->triangleIndexList1, this->triangleIndexLength1);
    123130    }
    124131    if( this->triangleIndexLength2 >= 3)
    125132    {
    126       this->nodeRight = new OBBTreeNode(*this->obbTree, depth - 1);
     133      this->nodeRight = new OBBTreeNode(*this->obbTree, this, depth - 1);
    127134      this->nodeRight->spawnBVTree(modelInf, this->triangleIndexList2, this->triangleIndexLength2);
    128135    }
     
    139146 * @param length: the length of the indexes array
    140147 */
    141 void OBBTreeNode::calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length)
     148void OBBTreeNode::calculateBoxCovariance(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
    142149{
    143150  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
     
    269276 */
    270277void OBBTreeNode::calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf,
    271     const int* triangleIndexes, unsigned int length)
     278    const int* triangleIndexes, int length)
    272279{
    273280
     
    305312 * @param length: the length of the indexes array
    306313 */
    307 void OBBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length)
     314void OBBTreeNode::calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, int length)
    308315{
    309316
     
    448455
    449456  /* find the center of the box */
    450 
    451457  this->separationPlane = Plane(box.axis[longestAxisIndex], box.center);
    452458  this->sepPlaneCenter[0] = box.center.x;
Note: See TracChangeset for help on using the changeset viewer.