Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10695 in orxonox.OLD for trunk/src/lib/math/quaternion.cc


Ignore:
Timestamp:
Jun 14, 2007, 4:46:18 PM (17 years ago)
Author:
snellen
Message:

changes on soundengine and mover by fabian landau

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/math/quaternion.cc

    r9656 r10695  
    7979 * @param yaw: the yaw in radians
    8080 */
    81 Quaternion::Quaternion (float roll, float pitch, float yaw)
    82 {
     81Quaternion::Quaternion (float attitude, float heading, float bank)
     82{
     83/*
    8384  float cr, cp, cy, sr, sp, sy, cpcy, spsy;
    8485
     
    99100  v.y = cr * sp * cy + sr * cp * sy;
    100101  v.z = cr * cp * sy - sr * sp * cy;
    101 }
     102*/
     103  float c1, c2, c3, s1, s2, s3;
     104
     105  c1 = cos(heading / 2);
     106  c2 = cos(attitude / 2);
     107  c3 = cos(bank / 2);
     108
     109  s1 = sin(heading / 2);
     110  s2 = sin(attitude / 2);
     111  s3 = sin(bank / 2);
     112
     113  w = c1 * c2 * c3 - s1 * s2 * s3;
     114  v.x = s1 * s2 * c3 +c1 * c2 * s3;
     115  v.y = s1 * c2 * c3 + c1 * s2 * s3;
     116  v.z = c1 * s2 * c3 - s1 * c2 * s3;
     117}
     118
    102119
    103120/**
     
    271288}
    272289
     290/**
     291 * @returns Bank, Attitude, Heading
     292 */
     293Vector Quaternion::getRotation() const
     294{
     295  return Vector(getAttitude(), getHeading(), getBank());
     296}
    273297
    274298
Note: See TracChangeset for help on using the changeset viewer.