Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4545 in orxonox.OLD for orxonox/trunk/src/lib/math


Ignore:
Timestamp:
Jun 7, 2005, 11:15:57 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: further improved the vector class, now it can be used like an array :)), finished calculation of the covariance matrix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/math/vector.h

    r4477 r4545  
    1111#include <math.h>
    1212#include "compiler.h"
     13#include "abstract_model.h"
    1314//! PI the circle-constant
    1415#define PI 3.14159265359f
     
    2627  ~Vector () {}
    2728
     29  /** \param index The index of the "array" \returns the x/y/z coordinate */
     30  inline float operator[] (float index) const {if( index == 0) return this->x; if( index == 1) return this->y; if( index == 2) return this->z;}
    2831  /**  \param v The vector to add \returns the addition between two vectors (this + v) */
    2932  inline Vector operator+ (const Vector& v) const { return Vector(x + v.x, y + v.y, z + v.z); };
     
    4851  /** \brief copy constructor \todo (i do not know it this is faster) \param v the vector to assign to this vector. \returns the vector v */
    4952  inline const Vector& operator= (const Vector& v) { this->x = v.x; this->y = v.y; this->z = v.z; return *this; };
     53  /** \brief copy constructor  \param v the sVec3D to assign to this vector. \returns the vector v */
     54  inline const Vector& operator= (const sVec3D& v) { this->x = v[0]; this->y = v[1]; this->z = v[2]; }
    5055  /** \param v: the other vector \return the dot product of the vectors */
    5156  float dot (const Vector& v) const { return x*v.x+y*v.y+z*v.z; };
Note: See TracChangeset for help on using the changeset viewer.