Browse Source

Merge pull request #2239 from kd0aij/addRot_v100

add a new rotation to lib/conversion
sbg
Lorenz Meier 10 years ago
parent
commit
472ca323a1
  1. 7
      src/lib/conversion/rotation.cpp
  2. 6
      src/lib/conversion/rotation.h

7
src/lib/conversion/rotation.cpp

@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
#include "rotation.h"
__EXPORT void
get_rot_matrix(enum Rotation rot, math::Matrix<3,3> *rot_matrix)
get_rot_matrix(enum Rotation rot, math::Matrix<3, 3> *rot_matrix)
{
float roll = M_DEG_TO_RAD_F * (float)rot_lookup[rot].roll;
float pitch = M_DEG_TO_RAD_F * (float)rot_lookup[rot].pitch;
@ -199,5 +199,10 @@ rotate_3f(enum Rotation rot, float &x, float &y, float &z) @@ -199,5 +199,10 @@ rotate_3f(enum Rotation rot, float &x, float &y, float &z)
y = -y;
return;
}
case ROTATION_PITCH_90_YAW_180: {
tmp = x; x = z; z = tmp;
y = -y;
return;
}
}
}

6
src/lib/conversion/rotation.h

@ -76,6 +76,7 @@ enum Rotation { @@ -76,6 +76,7 @@ enum Rotation {
ROTATION_PITCH_270 = 25,
ROTATION_ROLL_270_YAW_270 = 26,
ROTATION_ROLL_180_PITCH_270 = 27,
ROTATION_PITCH_90_YAW_180 = 28,
ROTATION_MAX
};
@ -113,14 +114,15 @@ const rot_lookup_t rot_lookup[] = { @@ -113,14 +114,15 @@ const rot_lookup_t rot_lookup[] = {
{ 0, 90, 0 },
{ 0, 270, 0 },
{270, 0, 270 },
{180, 270, 0 }
{180, 270, 0 },
{ 0, 90, 180 }
};
/**
* Get the rotation matrix
*/
__EXPORT void
get_rot_matrix(enum Rotation rot, math::Matrix<3, 3> *rot_matrix);
get_rot_matrix(enum Rotation rot, math::Matrix<3,3> *rot_matrix);
/**

Loading…
Cancel
Save