def angle(v1, v2, look): # FIXME pylint: disable=unused-argument
'''
Compute the unsigned angle between two vectors.
Returns a number between 0 and 180.
'''
import math
# TODO https://bodylabs.atlassian.net/projects/GEN/issues/GEN-1
# As pylint points out, we are not using `look` here. This method is
# supposed to be giving the angle between two vectors when viewed along a
# particular look vector, squashed into a plane. The code here is
# returning the angle in 3-space, which might be a reasonable function to
# have, but is not workable for computing the angle between planes as
# we're doing in bodylabs.measurement.anatomy.Angle.
dot = normalize(v1).dot(normalize(v2))
# Dot product sometimes slips past 1 or -1 due to rounding.
# Can't acos(-1.00001).
dot = max(min(dot, 1), -1)
return math.degrees(math.acos(dot))
评论列表
文章目录