Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 21, 2005, 10:33:42 PM (18 years ago)
Author:
patrick
Message:

orxonox/trunk: extended the obb interface dramaticaly:D , in near future it will support the modelInfo structure and therefore will be based on triangles

File:
1 edited

Legend:

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

    r5678 r5684  
    9696
    9797
     98/**
     99 *  creates a new BVTree or BVTree partition
     100 * @param depth: how much more depth-steps to go: if == 1 don't go any deeper!
     101 * @param modInfo: model informations from the abstrac model
     102 *
     103 * this function creates the Bounding Volume tree from a modelInfo struct and bases its calculations
     104 * on the triangle informations (triangle soup not polygon soup)
     105 */
     106void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modInfo)
     107{
     108  int length = 0;
     109  sVec3D* verticesList;
     110 
     111  PRINT(3)("\n");
     112  this->treeIndex = this->obbTree->getID();
     113  PRINTF(3)("OBB Depth: %i, tree index: %i, numVertices: %i\n", depth, treeIndex, length);
     114  this->depth = depth;
     115
     116
     117  this->bvElement = new OBB();
     118  this->bvElement->vertices = verticesList;
     119  this->bvElement->numOfVertices = length;
     120  PRINTF(3)("Created OBBox\n");
     121  this->calculateBoxCovariance(this->bvElement, modInfo);
     122  PRINTF(3)("Calculated attributes1\n");
     123  this->calculateBoxEigenvectors(this->bvElement, modInfo);
     124  PRINTF(3)("Calculated attributes2\n");
     125  this->calculateBoxAxis(this->bvElement,modInfo);
     126  PRINTF(3)("Calculated attributes3\n");
     127
     128  /* if this is the first node, the vertices data are the original ones of the model itself, so dont delete them in cleanup */
     129  if( this->treeIndex == 1)
     130    this->bvElement->bOrigVertices = true;
     131
     132  if( likely( this->depth > 0))
     133  {
     134    this->forkBox(this->bvElement);
     135
     136
     137//     if(this->tmpLen1 > 2)
     138//     {
     139//       OBBTreeNode* node1 = new OBBTreeNode();
     140//       this->nodeLeft = node1;
     141//       this->nodeLeft->spawnBVTree(depth - 1, this->tmpVert1, this->tmpLen1);
     142//     }
     143//     else
     144//     {
     145//       PRINTF(3)("Aboarding tree walk: less than 3 vertices left\n");
     146//     }
     147//
     148//     if( this->tmpLen2 > 2)
     149//     {
     150//       OBBTreeNode* node2 = new OBBTreeNode();
     151//       this->nodeRight = node2;
     152//       this->nodeRight->spawnBVTree(depth - 1, this->tmpVert2, this->tmpLen2);
     153//     }
     154//     else
     155//     {
     156//       PRINTF(3)("Abording tree walk: less than 3 vertices left\n");
     157//     }
     158
     159  }
     160}
     161
    98162
    99163/**
     
    101165 * @param depth: how much more depth-steps to go: if == 1 don't go any deeper!
    102166 * @param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
     167 *
     168 * this function creates an Bounding Volume tree from a vertices soup (no triangle data)
    103169 */
    104170void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
     
    151217      PRINTF(3)("Abording tree walk: less than 3 vertices left\n");
    152218    }
    153 
    154   }
    155 }
    156 
     219  }
     220}
     221
     222
     223void OBBTreeNode::calculateBoxCovariance(OBB* box, const modelInfo& modInfo)
     224{}
    157225
    158226
     
    346414
    347415
     416void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const modelInfo& modInfo)
     417{}
    348418
    349419void OBBTreeNode::calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length)
     
    394464//   PRINTF(0)("eigenvector: %f, %f, %f\n", box->axis[2].x, box->axis[2].y, box->axis[2].z);
    395465}
     466
     467
     468void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo)
     469{}
    396470
    397471
Note: See TracChangeset for help on using the changeset viewer.