我究竟做错了什么?
在第一个打印中,这些值很模糊,在第二个打印中,它们都是零。
第一次打印-q:0.965926 0.000000 0.258819 0.000000
第二次打印-q:0.000000 0.000000 0.000000 0.000000
float *AnglesToQaternion(float roll, float pitch, float yaw) { // Convert Euler angles in degrees to quaternions
static float q[4];
roll = roll * DEG_TO_RAD;
pitch = pitch * DEG_TO_RAD;
yaw = yaw * DEG_TO_RAD;
float t0 = cosf(yaw * 0.5);
float t1 = sinf(yaw * 0.5);
float t2 = cosf(roll * 0.5);
float t3 = sinf(roll * 0.5);
float t4 = cosf(pitch * 0.5);
float t5 = sinf(pitch * 0.5); …Run Code Online (Sandbox Code Playgroud)