Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5716 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 22, 2005, 11:27:44 PM (19 years ago)
Author:
patrick
Message:

collision_detection: moved the treedepth variable and therefore the hole interface changed

Location:
branches/collision_detection/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/bv_tree.h

    r5702 r5716  
    3939  virtual ~BVTree();
    4040
    41   virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = 0;
    42   virtual void spawnBVTree(int depth, const modelInfo& modelInf) = 0;
     41  virtual void spawnBVTree(sVec3D *verticesList, const int length) = 0;
     42  virtual void spawnBVTree(const modelInfo& modelInf) = 0;
    4343  virtual void flushTree() = 0;
    4444
  • branches/collision_detection/src/lib/collision_detection/bv_tree_node.h

    r5703 r5716  
    2626  virtual ~BVTreeNode();
    2727
    28   virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length ) = 0;
    29   virtual void spawnBVTree(const int depth, const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;
     28  virtual void spawnBVTree(const sVec3D *verticesList, unsigned int length ) = 0;
     29  virtual void spawnBVTree(const modelInfo& modInfo, const int* triangleIndexes, unsigned int length) = 0;
    3030
    3131  virtual const BoundingVolume* getBV() const = 0;
  • branches/collision_detection/src/lib/collision_detection/cd_engine.cc

    r5713 r5716  
    166166{
    167167  if ( this->rootTree == NULL)
    168     this->rootTree = new OBBTree();
    169   this->rootTree->spawnBVTree(depth, vertices, numVertices);
     168    this->rootTree = new OBBTree(depth, vertices, numVertices);
    170169}
    171170
  • branches/collision_detection/src/lib/collision_detection/obb_tree.cc

    r5713 r5716  
    3131 *  standard constructor
    3232*/
    33 OBBTree::OBBTree ()
     33OBBTree::OBBTree(int depth, sVec3D *verticesList, const int length)
     34  : BVTree()
    3435{
     36  this->depth = depth;
    3537  this->init();
     38  this->spawnBVTree(verticesList, length);
    3639}
    3740
    38 OBBTree::OBBTree(int depth, sVec3D *verticesList, const int length)
     41
     42OBBTree::OBBTree(int depth, const modelInfo& modelInf)
     43  : BVTree()
    3944{
     45  this->depth = depth;
    4046  this->init();
    41   this->spawnBVTree(depth, verticesList, length);
    42 }
    43 
    44 OBBTree::OBBTree(int depth, const modelInfo& modInfo)
    45 {
    46   this->init();
    47   this->spawnBVTree(depth, modInfo);
     47  this->spawnBVTree(modelInf);
    4848}
    4949
     
    5353{
    5454  this->setClassID(CL_OBB_TREE, "OBBTree");
    55 
    5655  this->rootNode = NULL;
    57 
    5856  this->id = 0;
    5957}
     
    6967
    7068
    71 void OBBTree::spawnBVTree(int depth, sVec3D *verticesList, const int length)
     69void OBBTree::spawnBVTree(sVec3D *verticesList, const int length)
    7270{
    7371  if( unlikely(this->rootNode != NULL))
     
    7876  OBBTreeNode* node = new OBBTreeNode(*this, depth);
    7977  this->rootNode = node;
    80   this->rootNode->spawnBVTree(--depth, verticesList, length);
     78  this->rootNode->spawnBVTree(verticesList, length);
    8179}
    8280
    8381
    84 void OBBTree::spawnBVTree(int depth, const modelInfo& modelInf)
     82void OBBTree::spawnBVTree(const modelInfo& modelInf)
    8583{
    8684  if( unlikely(this->rootNode != NULL))
     
    9795    triangleIndexes[i] = i;
    9896
    99   this->rootNode->spawnBVTree(--depth, modelInf, triangleIndexes, modelInf.numTriangles);
     97  this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles);
    10098}
    10199
     
    157155    }
    158156
    159   this->spawnBVTree(3, vertList, length);
     157  this->spawnBVTree(vertList, length);
    160158
    161159  PRINT(0)("=  Spawning Tree: Finished\n");
  • branches/collision_detection/src/lib/collision_detection/obb_tree.h

    r5702 r5716  
    2020
    2121  public:
    22     OBBTree();
    2322    OBBTree(int depth, sVec3D *verticesList, const int length);
    2423    OBBTree(int depth, const modelInfo& modInfo);
     
    2625    void init();
    2726
    28     virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length);
    29     virtual void spawnBVTree(int depth, const modelInfo& modelInf);
     27    virtual void spawnBVTree(sVec3D *verticesList, const int length);
     28    virtual void spawnBVTree(const modelInfo& modelInf);
    3029    virtual void flushTree();
    3130
     
    4342    OBBTreeNode*         rootNode;                        //!< reference to the root node of the tree
    4443    int                  id;
     44    int                  depth;                           //!< the depth of the tree to generate
    4545};
    4646
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5713 r5716  
    7979    OBBTreeNode_sphereObj = gluNewQuadric();
    8080}
     81
    8182
    8283/**
     
    114115 * on the triangle informations (triangle soup not polygon soup)
    115116 */
    116 void OBBTreeNode::spawnBVTree(const int depth, const modelInfo& modelInf,
    117                               const int* triangleIndexes, unsigned int length)
     117void OBBTreeNode::spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length)
    118118{
    119119  sVec3D* verticesList;
     
    172172 * this function creates an Bounding Volume tree from a vertices soup (no triangle data)
    173173 */
    174 void OBBTreeNode::spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length)
     174void OBBTreeNode::spawnBVTree(const sVec3D *verticesList, unsigned int length)
    175175{
    176176//   PRINTF(3)("\n");
     
    281281        r = *tmpVec;
    282282
    283 
    284283        covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j] * p[k] +
    285284            q[j] * q[k] + r[j] * r[k]) - center[j] * center[k];
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.h

    r5713 r5716  
    3131    virtual inline const BoundingVolume* getBV() const { return (BoundingVolume*)this->bvElement; }
    3232
    33 
    34     virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length);
    35     virtual void spawnBVTree(const int depth, const modelInfo& modelInf,
    36                              const int* triangleIndexes, unsigned int length);
     33    virtual void spawnBVTree(const sVec3D *verticesList, unsigned int length);
     34    virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    3735
    3836    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
     
    4846    void calculateBoxEigenvectors(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    4947    void calculateBoxAxis(OBB& box, const modelInfo& modelInf, const int* triangleIndexes, unsigned int length);
    50 
    5148    void forkBox(OBB& box);
    5249
  • branches/collision_detection/src/orxonox.cc

    r5641 r5716  
    5757#include <string.h>
    5858
    59 int verbose = 4;
     59int verbose = 5;
    6060
    6161using namespace std;
Note: See TracChangeset for help on using the changeset viewer.