Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5688 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 21, 2005, 11:27:39 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: the const collision detection war - strike

Location:
trunk/src/lib
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/collision_detection/bounding_volume.h

    r5279 r5688  
    2424    inline const Vector* getCenter() const { return this->center; }
    2525
    26     sVec3D* getVertices() const { return this->vertices; }
     26    const sVec3D* getVertices() const { return this->vertices; }
    2727    virtual void mergeWith(const BoundingVolume &bv) = 0;
    2828
     
    3434    Vector*             center;                     //!< Center point of box
    3535
    36     sVec3D*             vertices;                   //!< if CD_STORE_VERTICES enabled, this is the place, where the vert. will be sotred
     36    const sVec3D*       vertices;                   //!< if CD_STORE_VERTICES enabled, this is the place, where the vert. will be sotred
    3737    int                 numOfVertices;              //!< number of vertices in the vertices buffer
    3838    bool                bOrigVertices;              //!< is true if the vertices pointer points to the original model data - only important for deleting
  • trunk/src/lib/collision_detection/bv_tree_node.h

    r5684 r5688  
    2626  virtual ~BVTreeNode();
    2727
    28   virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length ) = 0;
     28  virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length ) = 0;
    2929  virtual void spawnBVTree(const int depth, const modelInfo& modInfo) = 0;
    3030
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r5686 r5688  
    168168 * this function creates an Bounding Volume tree from a vertices soup (no triangle data)
    169169 */
    170 void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
     170void OBBTreeNode::spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length)
    171171{
    172172  PRINT(3)("\n");
     
    225225
    226226
    227 void OBBTreeNode::calculateBoxCovariance(OBB* box, sVec3D* verticesList, int length)
     227void OBBTreeNode::calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length)
    228228{
    229229  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
     
    417417{}
    418418
    419 void OBBTreeNode::calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length)
     419void OBBTreeNode::calculateBoxEigenvectors(OBB* box, const sVec3D* verticesList, unsigned int length)
    420420{
    421421
     
    468468void OBBTreeNode::calculateBoxAxis(OBB* box, const modelInfo& modInfo)
    469469{
    470   this->calculateBoxAxis( box, &modInfo.pVertices, modInfo.numVertices);
    471 }
    472 
    473 
    474 
    475 void OBBTreeNode::calculateBoxAxis(OBB* box, sVec3D* verticesList, int length)
     470  //this->calculateBoxAxis( box, modInfo.pVertices, modInfo.numVertices);
     471}
     472
     473
     474
     475void OBBTreeNode::calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length)
    476476{
    477477
     
    617617  the points depending on which side they are located
    618618  */
    619   tList<sVec3D>      partition1;                           //!< the vertex partition 1
    620   tList<sVec3D>      partition2;                           //!< the vertex partition 2
     619  tList<const sVec3D>      partition1;                           //!< the vertex partition 1
     620  tList<const sVec3D>      partition2;                           //!< the vertex partition 2
    621621
    622622
     
    642642
    643643  /* now comes the separation into two different sVec3D arrays */
    644   tIterator<sVec3D>* iterator;                             //!< the iterator to go through the lists
    645   sVec3D*            element;                              //!< the elements
     644  tIterator<const sVec3D>* iterator;                       //!< the iterator to go through the lists
     645  const sVec3D*      element;                              //!< the elements
    646646  int                index;                                //!< index storage place
    647647  sVec3D*            vertList1;                            //!< the vertex list 1
  • trunk/src/lib/collision_detection/obb_tree_node.h

    r5684 r5688  
    2828    virtual ~OBBTreeNode();
    2929
    30     virtual void spawnBVTree(const int depth, sVec3D *verticesList, const int length);
     30    virtual void spawnBVTree(const int depth, const sVec3D *verticesList, unsigned int length);
    3131    virtual void spawnBVTree(const int depth, const modelInfo& modInfo);
    3232
     
    4242
    4343  private:
    44     void calculateBoxCovariance(OBB* box, sVec3D* verticesList, int length);
    45     void calculateBoxEigenvectors(OBB* box, sVec3D* verticesList, int length);
    46     void calculateBoxAxis(OBB* box, sVec3D* verticesList, int length);
     44    void calculateBoxCovariance(OBB* box, const sVec3D* verticesList, unsigned int length);
     45    void calculateBoxEigenvectors(OBB* box, const sVec3D* verticesList, unsigned int length);
     46    void calculateBoxAxis(OBB* box, const sVec3D* verticesList, unsigned int length);
    4747   
    4848    void calculateBoxCovariance(OBB* box, const modelInfo& modInfo);
     
    6262  private:
    6363    unsigned int        treeIndex;                  //!< Index number of the BV in the tree
    64     sVec3D*             vertices;                   //!< pointer to the vertices data
     64    const sVec3D*       vertices;                   //!< pointer to the vertices data
    6565    int                 numOfVertices;              //!< number of vertices in vertices data
    6666    int                 depth;                      //!< the depth of the node in the tree
    6767    static OBBTree*     obbTree;                    //!< reference to the obb tree
    6868    Plane*              separationPlane;            //!< the separation plane of the obb
    69     sVec3D*             sepPlaneCenter;             //!< only needed to draw plane @todo: separationPlane drawing
     69    const sVec3D*       sepPlaneCenter;             //!< only needed to draw plane @todo: separationPlane drawing
    7070    int                 longestAxisIndex;           //!< only needed to draw plane
    7171
  • trunk/src/lib/math/vector.cc

    r5672 r5688  
    513513 * @param c: third point
    514514*/
    515 Plane::Plane (Vector a, Vector b, Vector c)
     515Plane::Plane (const Vector& a, const Vector& b, const Vector& c)
    516516{
    517517  n = (a-b).cross(c-b);
     
    524524 * @param p: anchor point
    525525*/
    526 Plane::Plane (Vector norm, Vector p)
     526Plane::Plane (const Vector& norm, const Vector& p)
    527527{
    528528  n = norm;
     
    536536  * @param p: anchor point
    537537*/
    538 Plane::Plane (Vector norm, sVec3D g)
     538Plane::Plane (const Vector& norm, const sVec3D& g)
    539539{
    540540  Vector p(g[0], g[1], g[2]);
  • trunk/src/lib/math/vector.h

    r5672 r5688  
    276276  float k;    //!< Offset constant
    277277
    278   Plane (Vector a, Vector b, Vector c);
    279   Plane (Vector norm, Vector p);
    280   Plane (Vector norm, sVec3D p);
    281   Plane (Vector n, float k) : n(n), k(k) {} //!< assignment constructor
     278  Plane (const Vector& a, const Vector& b, const Vector& c);
     279  Plane (const Vector& norm, const Vector& p);
     280  Plane (const Vector& norm, const sVec3D& p);
     281  Plane (const Vector& n, float k) : n(n), k(k) {} //!< assignment constructor
    282282  Plane () : n(Vector(1,1,1)), k(0) {}
    283283  ~Plane () {}
Note: See TracChangeset for help on using the changeset viewer.