Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4560 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jun 9, 2005, 12:21:08 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: compiles again, some smaller changes in the cd engine

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

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/bounding_volume.cc

    r4557 r4560  
    1717
    1818#include "bounding_volume.h"
     19#include "vector.h"
    1920
    2021using namespace std;
  • orxonox/trunk/src/lib/collision_detection/bounding_volume.h

    r4557 r4560  
    2424  inline const Vector* getCenter() const { return this->center; }
    2525
    26   virtual tList<sVect3D>* getVertices() const = NULL;
     26  virtual sVect3D* getVertices() const = NULL;
    2727  virtual void mergeWith(const BoundingVolume &bv) = NULL;
    2828
     
    3232
    3333
    34  protected:
     34 public:
    3535  Vector*             center;                     //!< Center point of box
    3636
  • orxonox/trunk/src/lib/collision_detection/obb.h

    r4557 r4560  
    2222
    2323  inline const Vector* getAxis () const { return this->axis; }
    24   inline const sVect3D* getHalfLength() const { return this->halfLength; }
     24  inline const float* getHalfLength() const { return this->halfLength; }
    2525
    26   virtual tList<sVect3D>* getVertices() const { return this->verticesBuffer; }
     26  virtual sVect3D* getVertices() const { return this->vertices; }
    2727  virtual void mergeWith(const BoundingVolume &bv);
    2828
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4557 r4560  
    5656{
    5757  this->bvElement = this->createBox();
    58   this->calculateBoxAttributes(box);
    59   this->forkBox(box);
     58  this->calculateBoxAttributes(this->bvElement, verticesList, length);
     59  this->forkBox(this->bvElement);
    6060}
    6161
     
    6767
    6868
    69 void OBBTreeNode::calculateBoxAttributes(OBB* box)
     69void OBBTreeNode::calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length)
    7070{
    7171  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
     
    7575  Vector    p, q, r;                                 //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d
    7676  Vector    t1, t2;                                  //!< temporary values
    77   float     covariance[3][3];                        //!< the covariance matrix
     77  float**   covariance;                               //!< the covariance matrix
    7878   
    7979  this->numOfVertices = length;
     
    130130      printf(" |\n");
    131131    }
    132   printf("center: %f, %f, %f\n\n", centre.x, centre.y, centre.z);
     132  printf("center: %f, %f, %f\n\n", center.x, center.y, center.z);
    133133
    134134  for(int i = 0; i < length; i++)
     
    137137    }
    138138
    139 
     139   
     140  for(int i = 0; i < 3; ++i)
     141    {
    140142   
    141   box->covarianceMatrix = covariance;
    142   box->center = center;
     143      box->covarianceMatrix[i][0] = covariance[i][0];
     144      box->covarianceMatrix[i][1] = covariance[i][1];
     145      box->covarianceMatrix[i][3] = covariance[i][2];
     146    }
     147  *box->center = center;
    143148
    144149
     
    161166  for(int i = 0; i < 3; ++i)
    162167    {
    163       if( aLength < box->axis[i])
     168      if( aLength < box->axis[i].len())
    164169        {
    165           aLength = box->axis[i];
     170          aLength = box->axis[i].len();
    166171          axisNr = i;
    167172        }
     
    194199  this->bvElement->axis;
    195200 
    196   glBegin(GL_TRIANGLE);
    197   glVertex3f(this->bvElement->center );
    198   glEnd();
     201  //glBegin(GL_TRIANGLE);
     202  //glVertex3f(this->bvElement->center );
     203  //glEnd();
    199204}
    200205
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4557 r4560  
    2727  virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
    2828
    29   BoundingVolume* getBV(int index) const { return this->bvElement; }
     29  BoundingVolume* getBV(int index) const { return (BoundingVolume*)this->bvElement; }
    3030  inline const int getIndex() { return this->treeIndex; } 
    3131
     
    3838 private:
    3939  OBB* createBox();
    40   void calculateBoxAttributes(OBB* box);
     40  void calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length);
    4141  void forkBox(OBB* box);
    4242 
    4343
    44 
    4544 protected:
    46   BoundingVolume* bvElement;
     45  OBB* bvElement;
    4746  OBBTreeNode* nodeLeft;
    4847  OBBTreeNode* nodeRight;
Note: See TracChangeset for help on using the changeset viewer.