154{
155 quaternion quat = {0.7071f, 0.7071f, 0.f, 0.f};
157 printf(
"Euler: %.4g, %.4g, %.4g\n", eul.
pitch, eul.
roll, eul.
yaw);
158
160 printf(
"Quaternion: %.4g %+.4g %+.4g %+.4g\n", test_quat.
w,
162
163 assert(fabsf(test_quat.
w - quat.
w) < .01);
164 assert(fabsf(test_quat.q1 - quat.q1) < .01);
165 assert(fabsf(test_quat.q2 - quat.q2) < .01);
166 assert(fabsf(test_quat.q3 - quat.q3) < .01);
167}
euler euler_from_quat(const quaternion *in_quat)
Function to convert given quaternion to Euler angles.
Definition quaternions.c:88
quaternion quat_from_euler(const euler *in_euler)
Function to convert given Euler angles to a quaternion.
Definition quaternions.c:47
3D Euler or Tait-Bryan angles (in radian)
Definition geometry_datatypes.h:81
float roll
or bank = rotation about X axis
Definition geometry_datatypes.h:84
float pitch
or elevation = rotation about Y axis
Definition geometry_datatypes.h:89
float yaw
or heading = rotation about Z axis
Definition geometry_datatypes.h:94
a Quaternion type represented using a scalar or and a 3D vector
Definition geometry_datatypes.h:61
vec_3d dual
can be a 3D vector
Definition geometry_datatypes.h:70
float w
real part of quaternion
Definition geometry_datatypes.h:64
float z
Z co-ordinate.
Definition geometry_datatypes.h:25
float x
X co-ordinate.
Definition geometry_datatypes.h:23
float y
Y co-ordinate.
Definition geometry_datatypes.h:24