Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Oct 22, 2005, 10:55:51 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: MUCH better algorithm for the QuaternionSlerp in PNodes rotate-to function
also updated the Quaternion class, to now hold dot-product and distance

File:
1 edited

Legend:

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

    r5215 r5419  
    157157  /** @returns the inverted Quaterntion of this */
    158158  inline Quaternion inverse () const { return conjugate() / (w*w + v.x*v.x + v.y*v.y + v.z*v.z); };
     159  /** @returns the dot Product of a Quaternion */
     160  inline float dot (const Quaternion& q) const { return v.x*q.v.x + v.y*q.v.y + v.z*q.v.z + w*q.w; };
     161  /** @retuns the Distance between two Quaternions */
     162  inline float distance(const Quaternion& q) const { return 2*acos(fabsf(this->dot(q))); };
    159163  /** @param v: the Vector  @return a new Vector representing v rotated by the Quaternion */
    160164  inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; };
Note: See TracChangeset for help on using the changeset viewer.