Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4559 in orxonox.OLD


Ignore:
Timestamp:
Jun 9, 2005, 12:20:58 AM (19 years ago)
Author:
bensch
Message:

orxonox/tags: added new tag, version 0.3.0-pre-alpha

Location:
orxonox/tags/0.3.0-pre-alpha
Files:
1 deleted
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/bounding_volume.cc

    r4557 r4559  
    2727{
    2828   this->setClassID(CL_BOUNDING_VOLUME, "BoundingVolume");
    29    this->center = new Vector();
    3029
    3130}
     
    3938{
    4039  // delete what has to be deleted here
    41   delete this->center;
    4240}
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/bounding_volume.h

    r4557 r4559  
    3535  Vector*             center;                     //!< Center point of box
    3636
    37   sVect3D*            vertices;                   //!< if CD_STORE_VERTICES enabled, this is the place, where the vert. will be sotred
    38   int                 numOfVertices;              //!< number of vertices in the vertices buffer
     37  tList<sVect3D>*     verticesBuffer;             //!< if CD_STORE_VERTICES enabled, this is the place, where the vert. will be sotred
    3938};
    4039
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/obb.cc

    r4557 r4559  
    1818#include "obb.h"
    1919#include "list.h"
    20 #include "vector.h"
    2120
    2221using namespace std;
     
    2928{
    3029   this->setClassID(CL_OBB, "OBB");
    31    this->axis = new Vector[3];
    32    this->halfLength = new float[3];
    3330}
    3431
     
    4138{
    4239  // delete what has to be deleted here
    43   delete [] this->axis;
    44   delete [] this->halfLength;
    4540}
    4641
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/obb.h

    r4557 r4559  
    3232
    3333
    34  public:
     34 private:
    3535  Vector*          axis;                       //!< Axes of oriented box [x,y,z]
    36   float*           halfLength;                 //!< Half lengths of the box along the axis
    37   float            covarianceMatrix[3][3];     //!< the covariance matrix
     36  sVect3D*         halfLength;                 //!< Half lengths of the box
    3837
     38  OBB*             leftNode;                   //!< left node of the tree
     39  OBB*             rightNode;                  //!< right node of the tree
    3940};
    4041
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/obb_tree_node.cc

    r4557 r4559  
    5555void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
    5656{
    57   this->bvElement = this->createBox();
    58   this->calculateBoxAttributes(box);
    59   this->forkBox(box);
    60 }
    61 
    62 
    63 OBB* OBBTreeNode::createBox()
    64 {
    65   return new OBB();
    66 }
    67 
    68 
    69 void OBBTreeNode::calculateBoxAttributes(OBB* box)
    70 {
    7157  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
    7258  float     face;                                    //!< surface area of the entire convex hull
    7359  Vector    centroid[length];                        //!< centroid of the i'th convex hull 
    74   Vector    center;                                  //!< the center of the entire hull
     60  Vector    centre;                                  //!< the centre of the entire hull
     61  OBB*      obb = new OBB();                         //!< the new obb to add
    7562  Vector    p, q, r;                                 //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d
    7663  Vector    t1, t2;                                  //!< temporary values
     
    9885      centroid[i] = (p + q + r) * 1/3;
    9986      /* now calculate the centroid of the entire convex hull, weighted average of triangle centroids */
    100       center += centroid[i] * facelet[i];
     87      centre += centroid[i] * facelet[i];
    10188    }
    10289  /* take the average of the centroid sum */
    103   center /= face;
     90  centre /= face;
    10491 
    10592  /* now calculate the covariance matrix - if not written in three for-loops, it would compute faster: minor */
     
    115102
    116103              covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] +
    117                                                                 q[j] * q[k] + r[j]*r[k]) - center[j] * center[k];
     104                                                                q[j] * q[k] + r[j]*r[k]) - centre[j] * centre[k];
    118105            }
    119106        }
    120107    }
    121  
     108
    122109  printf("Covariance Matrix:\n");
    123110  for(int j = 0; j < 3; ++j)
     
    136123      printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
    137124    }
    138 
    139 
    140    
    141   box->covarianceMatrix = covariance;
    142   box->center = center;
    143 
    144 
    145   /* now getting spanning vectors of the sub-space:
    146      the eigenvectors of a symmertric matrix, such as the
    147      covarience matrix are mutually orthogonal.
    148      after normalizing them, they can be used as a the basis
    149      vectors
    150   */
    151  
    152 
    153 }
    154 
    155 
    156 void OBBTreeNode::forkBox(OBB* box)
    157 {
    158   /* get the longest axis of the box */
    159   float aLength = -1.0f;
    160   int axisNr = 0;
    161   for(int i = 0; i < 3; ++i)
    162     {
    163       if( aLength < box->axis[i])
    164         {
    165           aLength = box->axis[i];
    166           axisNr = i;
    167         }
    168     }
    169  
    170   /* get the closest vertex near the center */
    171125 
    172126}
     
    191145
    192146void OBBTreeNode::drawBVPolygon(int currentDepth, const int depth) const
    193 {
    194   this->bvElement->axis;
    195  
    196   glBegin(GL_TRIANGLE);
    197   glVertex3f(this->bvElement->center );
    198   glEnd();
    199 }
     147{}
    200148
    201149
  • orxonox/tags/0.3.0-pre-alpha/src/lib/collision_detection/obb_tree_node.h

    r4557 r4559  
    1414// FORWARD DEFINITION
    1515class BoundingVolume;
    16 class OBB;
    1716//struct sVec3D;
    1817
     
    3635  virtual void drawBVBlended(int currentDepth, const int depth) const;
    3736
    38  private:
    39   OBB* createBox();
    40   void calculateBoxAttributes(OBB* box);
    41   void forkBox(OBB* box);
    42  
    43 
    4437
    4538 protected:
  • orxonox/tags/0.3.0-pre-alpha/src/story_entities/world.cc

    r4558 r4559  
    506506  new PhysicsConnection(system, gravity);
    507507  //    new PhysicsConnection(this->localPlayer, gravity);
    508 
    509508
    510509  TestEntity* testEntity = new TestEntity();
Note: See TracChangeset for help on using the changeset viewer.