Changeset 15 in flair-src for trunk/lib/FlairCore/src/RotationMatrix.cpp
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/RotationMatrix.cpp
r2 r15 21 21 #include "math.h" 22 22 23 namespace flair 24 { 25 namespace core 26 { 23 namespace flair { 24 namespace core { 27 25 28 26 RotationMatrix::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 } 37 34 } 35 } 38 36 } 39 37 40 RotationMatrix::~RotationMatrix() { 41 42 } 38 RotationMatrix::~RotationMatrix() {} 43 39 44 40 void 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]); 48 44 } 49 45 50 46 Euler RotationMatrix::ToEuler(void) const { 51 52 53 47 Euler euler; 48 ToEuler(euler); 49 return euler; 54 50 } 55 51 56 float & RotationMatrix::operator()(size_t row,size_t col) {57 if(row<3 && col<3) {58 59 60 Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);61 62 52 float &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 } 63 59 } 64 60 65 const float & RotationMatrix::operator()(size_t row,size_t col) const {66 if(row<3 && col<3) {67 68 69 Printf("RotationMatrix: index (%i,%i) out of bound\n",row,col);70 71 61 const 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 } 72 68 } 73 69
Note:
See TracChangeset
for help on using the changeset viewer.