Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4553 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 8, 2005, 11:59:09 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: some more changes to display the data correctly

Location:
orxonox/trunk/src/lib/collision_detection
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/bv_tree.h

    r4550 r4553  
    88#define _BV_TREE_H
    99
     10
    1011#include "base_object.h"
     12#include "abstract_model.h"
    1113
    1214// FORWARD DEFINITION
     
    2123  virtual ~BVTree();
    2224
    23   virtual void spawnBVTree(int depth);
    24   virtual void flushTree();
     25  virtual void spawnBVTree(int depth, sVec3D *verticesList, const int length) = NULL;
     26  virtual void flushTree() = NULL;
    2527
    26   BoundingVolume* getBV(int index) const;
    27  
    28   virtual void collideWith(const BVTree &tree);
    2928
    30   virtual void drawBV(int currentDepth, const int depth) const;
    31   virtual void drawBVPolygon(int currentDepth, const int depth) const;
    32   virtual void drawBVBlended(int currentDepth, const int depth) const;
     29  virtual void drawBV(int currentDepth, const int depth) const = NULL;
     30  virtual void drawBVPolygon(int currentDepth, const int depth) const = NULL;
     31  virtual void drawBVBlended(int currentDepth, const int depth) const = NULL;
    3332
    3433 protected:
     
    3635
    3736 private:
    38   BoundingVolume* firstElement;
     37
    3938
    4039};
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4551 r4553  
    9393 
    9494  /* generate some test vertices */
    95   sVec3D vertList[] = {{1.0, 3.0, 4.0},{3.5, 6.2, 9.6},{6.4, 9.0, 2.0}};
     95  sVec3D* vertList = new sVec3D[3];
     96  sVec3D data[]  = {{0.0, 0.0, 0.0},{5.0, 0.0, 10.0},{-5.0, 0.0, 10.0}};
     97
     98  for(int i = 0; i < 3; ++i)
     99    {
     100      vertList[i][0] = data[i][0];
     101      vertList[i][1] = data[i][1];
     102      vertList[i][2] = data[i][2];
     103    }
    96104
    97105  this->spawnBVTree(1, vertList, 3);
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4551 r4553  
    6464  float     covariance[3][3];                        //!< the covariance matrix
    6565   
     66  this->numOfVertices = length;
     67  this->vertices = verticesList;
     68
    6669  /* fist compute all the convex hull face/facelets and centroids */
    6770  for(int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
    6871    {
    69       p = *(verticesList + i);
    70       q = *(verticesList + i + 1);
    71       r = *(verticesList + i + 2);
     72      p = verticesList[i];
     73      q = verticesList[i +1];
     74      r = verticesList[i + 2];
    7275     
    7376      t1 = p - q; t2 = p - r;
     
    9497          for(int i = 0; i < length; i+=3)
    9598            {
    96               p = *(verticesList + i);
    97               q = *(verticesList + i + 1);
    98               r = *(verticesList + i + 2);
     99              p = verticesList[i];
     100              q = verticesList[i +1];
     101              r = verticesList[i + 2];
    99102
    100103              covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] +
     
    105108
    106109  printf("Covariance Matrix:\n");
    107     for(int j = 0; j < 3; ++j)
     110  for(int j = 0; j < 3; ++j)
    108111    {
    109112      printf(" |");
     
    114117      printf(" |\n");
    115118    }
     119  printf("center: %f, %f, %f\n\n", centre.x, centre.y, centre.z);
     120
     121  for(int i = 0; i < length; i++)
     122    {
     123      printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
     124    }
     125 
    116126}
    117127
     
    122132
    123133void OBBTreeNode::drawBV(int currentDepth, const int depth) const
    124 {}
     134{
     135  glColor3f(1.0, 1.0, 1.0);
     136  glBegin(GL_TRIANGLES);
     137  for(int i = 0; i < this->numOfVertices; ++i)
     138    {
     139      glVertex3f(this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]);
     140      //printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]);
     141    }
     142  glEnd();
     143}
    125144
    126145
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4550 r4553  
    4444 private:
    4545  unsigned int        treeIndex;                  //!< Index number of the BV in the tree
     46  sVec3D*             vertices;                   //!< pointer to the vertices data
     47  int                 numOfVertices;              //!< number of vertices in vertices data
    4648
    4749};
Note: See TracChangeset for help on using the changeset viewer.