Changeset 100 in flair-src for trunk/lib/FlairCore/src/RotationMatrix.cpp


Ignore:
Timestamp:
Oct 5, 2016, 4:11:18 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

passage quaternoin 3dmgx3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/RotationMatrix.cpp

    r15 r100  
    1919#include "Object.h"
    2020#include "Euler.h"
     21#include "Quaternion.h"
    2122#include "math.h"
    2223
     
    5051}
    5152
     53void 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
     60Quaternion RotationMatrix::ToQuaternion(void) const {
     61  Quaternion quaternion;
     62  ToQuaternion(quaternion);
     63  return quaternion;
     64}
     65
    5266float &RotationMatrix::operator()(size_t row, size_t col) {
    5367  if (row < 3 && col < 3) {
Note: See TracChangeset for help on using the changeset viewer.