Changeset 100 in flair-src for trunk/lib/FlairCore
- Timestamp:
- Oct 5, 2016, 4:11:18 PM (8 years ago)
- Location:
- trunk/lib/FlairCore/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/RotationMatrix.cpp
r15 r100 19 19 #include "Object.h" 20 20 #include "Euler.h" 21 #include "Quaternion.h" 21 22 #include "math.h" 22 23 … … 50 51 } 51 52 53 void RotationMatrix::ToQuaternion(Quaternion &quaternion) const { 54 quaternion.q0 = 0.5f * sqrtf(1.0f + m[0][0] + m[1][1] + m[2][2]); 55 quaternion.q1 = 0.5f * sqrtf(1.0f + m[0][0] - m[1][1] - m[2][2]); 56 quaternion.q2 = 0.5f * sqrtf(1.0f - m[0][0] + m[1][1] - m[2][2]); 57 quaternion.q3 = 0.5f * sqrtf(1.0f - m[0][0] - m[1][1] + m[2][2]); 58 } 59 60 Quaternion RotationMatrix::ToQuaternion(void) const { 61 Quaternion quaternion; 62 ToQuaternion(quaternion); 63 return quaternion; 64 } 65 52 66 float &RotationMatrix::operator()(size_t row, size_t col) { 53 67 if (row < 3 && col < 3) { -
trunk/lib/FlairCore/src/RotationMatrix.h
r15 r100 18 18 namespace core { 19 19 class Euler; 20 class Quaternion; 20 21 21 22 /*! \class RotationMatrix … … 52 53 */ 53 54 Euler ToEuler(void) const; 55 56 /*! 57 * \brief Convert to quaternion 58 * 59 * \param quaternion output quaternion 60 */ 61 void ToQuaternion(Quaternion &quaternion) const; 62 63 /*! 64 * \brief Convert to quaternion 65 * 66 * \return quaternion 67 */ 68 Quaternion ToQuaternion(void) const; 69 54 70 /*! 55 71 * \brief matrix
Note:
See TracChangeset
for help on using the changeset viewer.