Changeset 10695 in orxonox.OLD for trunk/src/lib/math
- Timestamp:
- Jun 14, 2007, 4:46:18 PM (18 years ago)
- Location:
- trunk/src/lib/math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/math/quaternion.cc
r9656 r10695 79 79 * @param yaw: the yaw in radians 80 80 */ 81 Quaternion::Quaternion (float roll, float pitch, float yaw) 82 { 81 Quaternion::Quaternion (float attitude, float heading, float bank) 82 { 83 /* 83 84 float cr, cp, cy, sr, sp, sy, cpcy, spsy; 84 85 … … 99 100 v.y = cr * sp * cy + sr * cp * sy; 100 101 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 102 119 103 120 /** … … 271 288 } 272 289 290 /** 291 * @returns Bank, Attitude, Heading 292 */ 293 Vector Quaternion::getRotation() const 294 { 295 return Vector(getAttitude(), getHeading(), getBank()); 296 } 273 297 274 298 -
trunk/src/lib/math/quaternion.h
r9656 r10695 109 109 float getBank() const; 110 110 Quaternion getBankQuat() const; 111 112 Vector getRotation() const; 113 111 114 /** @returns the rotational axis of this Quaternion */ 112 115 inline Vector getSpacialAxis() const { return this->v / sin(acos(w));/*sqrt(v.x*v.x + v.y*v.y + v.z+v.z);*/ };
Note: See TracChangeset
for help on using the changeset viewer.