You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm evaluating the angular distance between two quaternions and it seems that values produced by Quaternion.distance are twice less in comparison with this formula:
The UTs checking angular distance for original and modified distance functions (test_angular_distance.py):
Quaternion.distance() returns the geodesic distance not angular distance. If you provide a source for the equation you are using, I can add an angular_distace() method based on this.
@KieranWynn thanks for your comment, please have a look at this (see Algorithms section)
Possible implementation:
def angular_distance(q0, q1):
#
# Calculates the angular distance between two quaternions in degrees
# q0, q1 shall be normalized
#
# According to formula:
# theta = 2*acos(|<q0,q1>|)
# from https://www.mathworks.com/help/fusion/ref/quaternion.dist.html
#
# Returns angle in degrees within the range [0, 180] degrees
#
dotProd = q0.x*q1.x + q0.y*q1.y + q0.z*q1.z + q0.w*q1.w
return np.degrees(2.0 * math.acos(max(0.0, min(abs(dotProd), 1.0))))
I ran into this same issue: the values I'm getting from absolute_distance() are twice as large as the expected value. An 'angular_distance()' function would be great!
I'm evaluating the angular distance between two quaternions and it seems that values produced by
Quaternion.distance
are twice less in comparison with this formula:The UTs checking angular distance for original and modified distance functions (
test_angular_distance.py
):The output:
Is it a bug in function or I'm confusing the usage of the function?
The text was updated successfully, but these errors were encountered: