Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4576 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 10, 2005, 2:18:01 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: calculating box dimensions

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

Legend:

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

    r4557 r4576  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    2626   \brief standard constructor
    2727*/
    28 OBB::OBB () 
     28OBB::OBB ()
    2929{
    30    this->setClassID(CL_OBB, "OBB"); 
    31    this->axis = new Vector[3];
     30   this->setClassID(CL_OBB, "OBB");
     31   this->axis = new Vector*[3];
    3232   this->halfLength = new float[3];
    3333}
     
    3838
    3939*/
    40 OBB::~OBB () 
     40OBB::~OBB ()
    4141{
    4242  // delete what has to be deleted here
  • orxonox/trunk/src/lib/collision_detection/obb.h

    r4560 r4576  
    1 /*! 
     1/*!
    22    \file obb.h
    33    \brief Definition of an OBB (object Oriented Bounding Box)
     
    2121
    2222
    23   inline const Vector* getAxis () const { return this->axis; }
    24   inline const float* getHalfLength() const { return this->halfLength; } 
     23  inline Vector** getAxis () const { return this->axis; }
     24  inline const float* getHalfLength() const { return this->halfLength; }
    2525
    2626  virtual sVect3D* getVertices() const { return this->vertices; }
     
    3333
    3434 public:
    35   Vector*          axis;                       //!< Axes of oriented box [x,y,z]
     35  Vector**         axis;                       //!< Axes of oriented box [x,y,z]
    3636  float*           halfLength;                 //!< Half lengths of the box along the axis
    3737  float            covarianceMatrix[3][3];     //!< the covariance matrix
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4573 r4576  
    166166     vectors
    167167  */
    168 
    169168  Matrix                V(3,3);                               //!< for eigenvectors
    170169  DiagonalMatrix        D(3);                                 //!< for eigenvalues   
    171170  SymmetricMatrix       C(3);                                 //!< for the covariance symmetrical matrix
    172   Vector**              axis;                                 //!< the references to the obb axis
     171  Vector**              axis = new Vector*[3];                //!< the references to the obb axis
    173172 
    174173  C(1,1) = covariance[0][0];
     
    196195  }
    197196
    198    //axis1 =
    199 
     197  axis[0] = new Vector(V(1, 1), V(2, 1), V(3, 1));
     198  axis[1] = new Vector(V(1, 2), V(2, 2), V(3, 2));
     199  axis[2] = new Vector(V(1, 3), V(2, 3), V(3, 3));
     200  box->axis = axis;
     201 
     202  printf("eigenvector: %f, %f, %f\n", V(1, 1), V(2, 1), V(3, 1));
     203  printf("eigenvector: %f, %f, %f\n", V(1, 2), V(2, 2), V(3, 2));
     204  printf("eigenvector: %f, %f, %f\n", V(1, 3), V(2, 3), V(3, 3));
     205
     206
     207  /* now get the axis length */
     208  Line                ax1(*box->center, *box->axis[0]);      //!< the the axis representation
     209  Line                ax2(*box->center, *box->axis[1]);      //!< the the axis representation
     210  Line                ax3(*box->center, *box->axis[2]);      //!< the the axis representation
     211 
     212
     213 
    200214}
    201215
     
    208222  for(int i = 0; i < 3; ++i)
    209223    {
    210       if( aLength < box->axis[i].len())
     224      if( aLength < box->axis[i]->len())
    211225        {
    212           aLength = box->axis[i].len();
     226          aLength = box->axis[i]->len();
    213227          axisNr = i;
    214228        }
Note: See TracChangeset for help on using the changeset viewer.