- Timestamp:
- Jul 4, 2006, 2:26:42 AM (18 years ago)
- Location:
- branches/presentation/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/graphics/importer/md3/md3_model.cc
r8724 r9090 525 525 float interpolatedMatrix[4][4]; 526 526 527 Quaternion currQuat(currFrameTag->matrix); currQuat.matrix(currRot); 528 Quaternion nextQuat(nextFrameTag->matrix); nextQuat.matrix(nextRot); 527 /// TODO CHANGED BY BENSCH TO MATCH NEW QUATERNION FUNCTIONALITY 528 Quaternion currQuat; currQuat.from3x3(currFrameTag->matrix); currQuat.matrix(currRot); 529 Quaternion nextQuat; nextQuat.from3x3(nextFrameTag->matrix); nextQuat.matrix(nextRot); 529 530 530 531 Quaternion interpolatedQuat = Quaternion::quatSlerp(currQuat, nextQuat, frac); interpolatedQuat.matrix(interpolatedMatrix); -
branches/presentation/src/lib/math/quaternion.cc
r8731 r9090 72 72 m[3][3] = 1; 73 73 74 *this = Quaternion(m);74 this->from4x4(m); 75 75 } 76 76 … … 279 279 * @param m: a 4x4 matrix in glMatrix order 280 280 */ 281 Quaternion::Quaternion(float m[4][4])281 void Quaternion::from4x4(float m[4][4]) 282 282 { 283 283 … … 327 327 328 328 /** 329 * Creates a quaternion from a 3x3 rotation matrix.329 * applies a quaternion from a 3x3 rotation matrix. 330 330 * @param mat The 3x3 source rotation matrix. 331 331 * @return The equivalent 4 float quaternion. 332 332 */ 333 Quaternion::Quaternion(float mat[3][3])333 void Quaternion::from3x3(float mat[3][3]) 334 334 { 335 335 int NXT[] = {1, 2, 0}; -
branches/presentation/src/lib/math/quaternion.h
r8894 r9090 39 39 /** creates a Default quaternion (multiplicational identity Quaternion)*/ 40 40 inline Quaternion () { w = 1; v = Vector(0,0,0); } 41 /** Copy constructor @param q the Quaternion to copy. */ 42 inline Quaternion (const Quaternion& q) { w = q.w; v = q.v; }; 41 43 /** creates a Quaternion looking into the direction v @param v: the direction @param f: the value */ 42 44 inline Quaternion (const Vector& v, float f) { this->w = f; this->v = v; } 43 Quaternion (float m[4][4]);44 Quaternion (float m[3][3]);45 45 /** turns a rotation along an axis into a Quaternion @param angle: the amount of radians to rotate @param axis: the axis to rotate around */ 46 46 inline Quaternion (float angle, const Vector& axis) { w = cos(angle/2.0); v = axis * sin(angle/2.0); } 47 47 Quaternion (const Vector& dir, const Vector& up); 48 48 Quaternion (float roll, float pitch, float yaw); 49 50 void from3x3(float m[3][3]); 51 void from4x4(float m[4][4]); 52 49 53 50 54 /** @param q: the Quaternion to compare with this one. @returns true if the Quaternions are the same, false otherwise */ -
branches/presentation/src/lib/math/vector.cc
r6617 r9090 40 40 Vector Vector::getNormalized() const 41 41 { 42 float l = this->len();43 if (unlikely(l == 1.0 || l== 0.0))42 float length = this->len(); 43 if (unlikely(length == 0.0)) 44 44 return *this; 45 45 else 46 return (*this / l );46 return (*this / length); 47 47 } 48 48 -
branches/presentation/src/lib/math/vector.h
r8894 r9090 42 42 Vector (float x, float y, float z) : x(x), y(y), z(z) {} //!< assignment constructor 43 43 Vector () : x(0), y(0), z(0) {} 44 ~Vector () {}45 44 46 45 /** @param v: the Vecor to compare with this one @returns true, if the Vecors are the same, false otherwise */
Note: See TracChangeset
for help on using the changeset viewer.