Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Aug 13, 2005, 7:35:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: the Quaternion multiplication-code is much faster now.
The previous approach was to brute force, and the new one is inlined :)

File:
1 edited

Legend:

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

    r4998 r4999  
    132132  /** @param f: the value to multiply by @returns the quaternion multiplied by f (this *= f) */
    133133  inline const Quaternion& operator*= (const float& f) {*this = *this * f; return *this;}
    134   Quaternion operator* (const Quaternion& q) const;
     134  /** @param q: another Quaternion to rotate this by @return a quaternion that represents the first one rotated by the second one (WARUNING: this operation is not commutative! e.g. (A*B) != (B*A)) */
     135  Quaternion operator* (const Quaternion& q) const { return Quaternion(Vector(this->w*q.v.x + this->v.x*q.w + this->v.y*q.v.z - this->v.z*q.v.y,
     136                                                                         this->w*q.v.y + this->v.y*q.w + this->v.z*q.v.x - this->v.x*q.v.z,
     137                                                                         this->w*q.v.z + this->v.z*q.w + this->v.x*q.v.y - this->v.y*q.v.x),
     138                                                                         this->w*q.w - this->v.x*q.v.x - this->v.y*q.v.y - this->v.z*q.v.z);
     139  };
    135140  /** @param q: the Quaternion to multiply by @returns the quaternion multiplied by q (this *= q) */
    136141  inline const Quaternion& operator*= (const Quaternion& q) {*this = *this * q; return *this; };
Note: See TracChangeset for help on using the changeset viewer.