I am using a motion tracking device equipped with a gyrometer/accelerometer/magnetometer. The device outputs its rotational orientation at any timepoint as a quaternion.
As I rotate the device from its original orientation, I am trying to calculate two things: (1) the distance along the surface of the sphere from its original orientation (I've actually already completed this step), and (2) the direction of the orientation - but the direction needs to be a simple 1 or -1, not a vector.
Let me explain further what I mean with regard to the direction: Let's assume the device begins in an initial rotation state, and then I rotate it in one direction. After completing some amount of rotation, I then rotate it back to its original position, and then I continue rotating it along that same trajectory - essentially rotating it in the opposite direction of my original rotation.
So, if I have an original quaternion Q0, and then I have another quaternion representing my first rotation Q1, I would then like to say for any future quaternion Qn:
- What is the distance of Qn from Q0?
- What is the direction (valid values are 1 or -1) of Qn from Q0? Where "1" is "in the same direction as the rotation from Q0 to Q1" and "-1" is "in the opposite direction as the rotation from Q0 to Q1".
Like I said, the "distance" part I have already solved thanks to finding this helpful post: https://math.stackexchange.com/questions/90081/quaternion-distance?newreg=f0fcab1eca8d4a4faaad1ea555d1cdf7
I haven't solved the direction part yet. The following posts have gotten me part of the way there:
But my understanding is still incomplete. Can anyone help elucidate how I could do this? Thanks!