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


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

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

    r2 r15  
    2121#include "math.h"
    2222
    23 namespace flair
    24 {
    25 namespace core
    26 {
     23namespace flair {
     24namespace core {
    2725
    2826RotationMatrix::RotationMatrix() {
    29     for(int i=0;i<3;i++) {
    30         for(int j=0;j<3;j++) {
    31             if(i==j) {
    32                 m[i][j]=1;
    33             }else {
    34                 m[i][j]=0;
    35             }
    36         }
     27  for (int i = 0; i < 3; i++) {
     28    for (int j = 0; j < 3; j++) {
     29      if (i == j) {
     30        m[i][j] = 1;
     31      } else {
     32        m[i][j] = 0;
     33      }
    3734    }
     35  }
    3836}
    3937
    40 RotationMatrix::~RotationMatrix() {
    41 
    42 }
     38RotationMatrix::~RotationMatrix() {}
    4339
    4440void RotationMatrix::ToEuler(Euler &euler) const {
    45     euler.roll=atanf(m[1][2]/m[2][2]);
    46     euler.pitch=asinf(-m[0][2]);
    47     euler.yaw=atan2f(m[0][1],m[0][0]);
     41  euler.roll = atanf(m[1][2] / m[2][2]);
     42  euler.pitch = asinf(-m[0][2]);
     43  euler.yaw = atan2f(m[0][1], m[0][0]);
    4844}
    4945
    5046Euler RotationMatrix::ToEuler(void) const {
    51     Euler euler;
    52     ToEuler(euler);
    53     return euler;
     47  Euler euler;
     48  ToEuler(euler);
     49  return euler;
    5450}
    5551
    56 float& RotationMatrix::operator()(size_t row,size_t col) {
    57     if(row<3 && col<3) {
    58         return m[row][col];
    59     } else {
    60         Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);
    61         return m[2][2];
    62     }
     52float &RotationMatrix::operator()(size_t row, size_t col) {
     53  if (row < 3 && col < 3) {
     54    return m[row][col];
     55  } else {
     56    Printf("RotationMatrix: index (%i,%i) out of bound\n", row, col);
     57    return m[2][2];
     58  }
    6359}
    6460
    65 const float& RotationMatrix::operator()(size_t row,size_t col) const {
    66     if(row<3 && col<3) {
    67         return m[row][col];
    68     } else {
    69         Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);
    70         return m[2][2];
    71     }
     61const float &RotationMatrix::operator()(size_t row, size_t col) const {
     62  if (row < 3 && col < 3) {
     63    return m[row][col];
     64  } else {
     65    Printf("RotationMatrix: index (%i,%i) out of bound\n", row, col);
     66    return m[2][2];
     67  }
    7268}
    7369
Note: See TracChangeset for help on using the changeset viewer.