Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2005, 10:40:18 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: new feature in vector class, now can overtake values of a sVec3D, spawn tree alg, fast-math library, thats not used anymore :)

File:
1 edited

Legend:

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

    r4543 r4544  
    1919#include "list.h"
    2020#include "obb.h"
     21#include "fast_math.h"
     22#include "vector.h"
    2123
    2224#include <math.h>
     
    5153   \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
    5254*/
    53 void OBBTreeNode::spawnBVTree(const int depth, const sVec3D *verticesList, const int length)
     55void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
    5456{
    5557  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
     
    5759  float     centroid[length];                        //!< centroid of the i'th convex hull 
    5860  OBB*      obb = new OBB();                         //!< the new obb to add
     61  Vector    p, q, r;                                 //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d
     62  Vector    t1, t2;
    5963
    60   /* fist compute all the convex hull facelets */
    61   for(int i = 0; i < length; ++i)
     64  /* fist compute all the convex hull face/facelets */
     65  for(int i = 0; i < length; i+=3)
    6266    {
    63       facelet[i] = 0.5f * fabs(5.0);
     67      p = *(verticesList + i);
     68      q = *(verticesList + i + 1);
     69      r = *(verticesList + i + 2);
     70     
     71      t1 = p - q; t2 = p - r;
     72     
     73      /* finding the facelet surface via cross-product */
     74      facelet[i] = 0.5f * fabs( t1.cross(t2).len() );
     75
     76      /* update the entire convex hull surface */
     77      face += facelet[i];
    6478    }
     79
     80
    6581}
    6682
Note: See TracChangeset for help on using the changeset viewer.