Signed angle between two vectors without a reference plane

前端 未结 4 989
余生分开走
余生分开走 2021-02-02 00:15

(In three dimensions) I\'m looking for a way to compute the signed angle between two vectors, given no information other than those vectors. As answered in this question, it is

4条回答
  •  借酒劲吻你
    2021-02-02 00:52

    Thanks all. After reviewing the comments here and looking back at what I was trying to do, I realized that I can accomplish what I need to do with the given, standard formula for a signed angle. I just got hung up in the unit test for my signed angle function.

    For reference, I'm feeding the resulting angle back into a rotate function. I had failed to account for the fact that this will naturally use the same axis as in signed_angle (the cross product of input vectors), and the correct direction of rotation will follow from which ever direction that axis is facing.

    More simply put, both of these should just "do the right thing" and rotate in different directions:

    rotate(cross(Va, Vb), signed_angle(Va, Vb), point)
    rotate(cross(Vb, Va), signed_angle(Vb, Va), point)
    

    Where the first argument is the axis of rotation and second is the amount to rotate.

提交回复
热议问题