Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4477 in orxonox.OLD for orxonox/trunk/src/lib/math/vector.h


Ignore:
Timestamp:
Jun 2, 2005, 4:35:22 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: vector is completely documented again :)

File:
1 edited

Legend:

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

    r4476 r4477  
    5252  /** \param v: the corss-product partner \returns the cross-product between this and v (this (x) v) */
    5353  inline Vector cross (const Vector& v) const { return Vector(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x ); }
    54   /** \param scales the this vector with v */
     54  /** \brief scales the this vector with v  \param v the vector to scale this with */
    5555  void scale(const Vector& v) {   x *= v.x;  y *= v.y; z *= v.z; };
    5656  /** \returns the length of the vector */
     
    102102{
    103103 public:
    104   Vector    v;        //!< Imaginary Vector
    105   float     w;        //!< Real part of the number
    106  
     104  /** \brief creates a Default quaternion (multiplicational identity Quaternion)*/
    107105  inline Quaternion () { w = 1; v = Vector(0,0,0); }
     106  /** \brief creates a Quaternion looking into the direction v \param v: the direction \param f: the value */
    108107  inline Quaternion (const Vector& v, float f) { this->w = f; this->v = v; }
    109108  Quaternion (float m[4][4]);
     109  /** \brief turns a rotation along an axis into a Quaternion \param angle: the amount of radians to rotate \param axis: the axis to rotate around */
    110110  inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2); v = axis * sin(angle/2); }
    111111  Quaternion (const Vector& dir, const Vector& up);
    112112  Quaternion (float roll, float pitch, float yaw);
    113113  Quaternion operator/ (const float& f) const;
    114   inline const Quaternion operator/= (const float& f) {*this = *this / f; return *this;}
     114  /** \param f: the value to divide by \returns the quaternion devided by f (this /= f) */
     115  inline const Quaternion& operator/= (const float& f) {*this = *this / f; return *this;}
    115116  Quaternion operator* (const float& f) const;
    116   inline const Quaternion operator*= (const float& f) {*this = *this * f; return *this;}
     117  /** \param f: the value to multiply by \returns the quaternion multiplied by f (this *= f) */
     118  inline const Quaternion& operator*= (const float& f) {*this = *this * f; return *this;}
    117119  Quaternion operator* (const Quaternion& q) const;
    118   inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this;}
    119   inline Quaternion operator+ (const Quaternion& q) const { return Quaternion(q.v + v, q.w + w); }
    120   inline const Quaternion& operator+= (const Quaternion& q) {this->v += q.v; this->w += q.w; return *this;}
     120  /** \param q: the Quaternion to multiply by \returns the quaternion multiplied by q (this *= q) */ 
     121  inline const Quaternion operator*= (const Quaternion& q) {*this = *this * q; return *this; };
     122  /** \param q the Quaternion to add to this \returns the quaternion added with q (this + q) */
     123  inline Quaternion operator+ (const Quaternion& q) const { return Quaternion(q.v + v, q.w + w); };
     124  /** \param q the Quaternion to add to this \returns the quaternion added with q (this += q) */
     125  inline const Quaternion& operator+= (const Quaternion& q) { this->v += q.v; this->w += q.w; return *this; };
     126  /** \param q the Quaternion to substrace from this \returns the quaternion substracted by q (this - q) */
    121127  inline Quaternion operator- (const Quaternion& q) const { return Quaternion(q.v - v, q.w - w); }
    122   inline const Quaternion& operator-= (const Quaternion& q) {this->v -= q.v; this->w -= q.w; return *this;}
     128  /** \param q the Quaternion to substrace from this \returns the quaternion substracted by q (this -= q) */
     129  inline const Quaternion& operator-= (const Quaternion& q) { this->v -= q.v; this->w -= q.w; return *this; };
     130  /** \brief copy constructor \param q: the Quaternion to set this to. \returns the Quaternion q (or this) */
    123131  inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;}
    124   Quaternion conjugate () const {  Quaternion r(*this);
    125   r.v = Vector() - r.v;
    126   return r;}
     132  /** \brief conjugates this Quaternion \returns the conjugate */
     133  inline Quaternion conjugate () const {  Quaternion r(*this);  r.v = Vector() - r.v;  return r;}
    127134  Quaternion inverse () const;
    128135  Vector apply (const Vector& f) const;
     
    131138 
    132139  void debug();
     140
     141 public:
     142  Vector    v;        //!< Imaginary Vector
     143  float     w;        //!< Real part of the number
     144
    133145};
    134146
Note: See TracChangeset for help on using the changeset viewer.