Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4544 in orxonox.OLD


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 :)

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

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/Makefile.am

    r4541 r4544  
    2525                     bv_tree_node.h \
    2626                     bounding_volume.h \
    27                      bounding_sphere.h
     27                     bounding_sphere.h \
     28                     fast_math.h
    2829
  • orxonox/trunk/src/lib/collision_detection/Makefile.in

    r4541 r4544  
    208208                     bv_tree_node.h \
    209209                     bounding_volume.h \
    210                      bounding_sphere.h
     210                     bounding_sphere.h \
     211                     fast_math.h
    211212
    212213all: all-am
  • orxonox/trunk/src/lib/collision_detection/bv_tree_node.h

    r4543 r4544  
    99
    1010#include "base_object.h"
     11#include "fast_math.h"
    1112
    1213// FORWARD DEFINITION
    1314class BoundingVolume;
    14 class sVec3D;
    1515class BVTree;
    1616template<class T> class tList;
  • orxonox/trunk/src/lib/collision_detection/collision.h

    r4526 r4544  
    1313
    1414class WorldEntity;
    15 class sVec3D;
    1615class BoundingVolume;
    1716
  • 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
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.h

    r4543 r4544  
    1212// FORWARD DEFINITION
    1313class BoundingVolume;
    14 class sVec3D;
    1514
    1615//! A class that represents a bounding volume tree
     
    2221  virtual ~OBBTreeNode();
    2322
    24   virtual void spawnBVTree(const int depth, const sVec3D *verticesList, const int length);
     23  virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
    2524
    2625  BoundingVolume* getBV(int index) const { return this->bvElement; }
Note: See TracChangeset for help on using the changeset viewer.