How to find the angle between two rotational quaternions?

255 Views Asked by At

Sample Dataset

I want to find out by much angle each quaternion is moving and if its rotating in the same direction ( clockwise / anti-clockwise)

Right now, I am doing the following to calculate the rotation but I am not sure if its correct.

def quaternion_angle(q1, q2):
    dot_product = np.dot(q1, q2)
    # Ensure dot product is within -1 and 1 for arccos
    dot_product = np.clip(dot_product, -1.0, 1.0)
    return np.arccos(dot_product) * 2 * 180/np.pi  # convert to degrees 
0

There are 0 best solutions below