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
The angle_between method allows to compute the unsigned angle between two either 2D or 3D vectors, while the angle_signed computes the signed angle but supports 2D vectors only.
I had a use case where I needed to compute the signed angle between two 3D vectors. Would you be interested in changing the angle_signed method to support 3D vectors as well? If you wouldn't, don't worry, I understand.
I was thinking about the following solution that does not break the current interface. Only the angle_signed method would be modified.
I would add the keyword argument positive_direction or plane_normal which is a Vector that is necessary to actually determine if the angle between two 3D vectors is positive or not. Its default value is None. This vector is just the normal of the plane where the two 3D vectors lie. We need to validate this input to actually check if it's a Vector and normal.
If the user provides two 2D vectors, the method works as it is now and the positive_direction argument is ignored regardless of its value.
If the user provides two 3D vectors and the positive_direction is not None, then the cross product of the two input vectors is computed and eventually the cosine similarity is computed between the cross product and the positive_direction vector which will be used to determine the sign of the angle.
If positive_direction is None a positive angle will be always returned.
Thanks!
The text was updated successfully, but these errors were encountered:
Hi @ajhynes7!
The
angle_between
method allows to compute the unsigned angle between two either 2D or 3D vectors, while theangle_signed
computes the signed angle but supports 2D vectors only.I had a use case where I needed to compute the signed angle between two 3D vectors. Would you be interested in changing the
angle_signed
method to support 3D vectors as well? If you wouldn't, don't worry, I understand.I was thinking about the following solution that does not break the current interface. Only the
angle_signed
method would be modified.I would add the keyword argument
positive_direction
orplane_normal
which is aVector
that is necessary to actually determine if the angle between two 3D vectors is positive or not. Its default value isNone
. This vector is just the normal of the plane where the two 3D vectors lie. We need to validate this input to actually check if it's aVector
and normal.If the user provides two 2D vectors, the method works as it is now and the
positive_direction
argument is ignored regardless of its value.If the user provides two 3D vectors and the
positive_direction
is notNone
, then the cross product of the two input vectors is computed and eventually the cosine similarity is computed between the cross product and thepositive_direction
vector which will be used to determine the sign of the angle.If
positive_direction
isNone
a positive angle will be always returned.Thanks!
The text was updated successfully, but these errors were encountered: