How to determine whether V3 is between V1 and V2 when we go from V1 to V2 counterclockwise?

后端 未结 5 1978
鱼传尺愫
鱼传尺愫 2021-01-12 15:37

I have three vectors V1, V2, and V3. Their origin points are on the axes\' origin. How could I determine whether V3 is between V1 and V2 when I move around counterclockwise

5条回答
  •  一向
    一向 (楼主)
    2021-01-12 16:02

    Calculate angle(V1), angle(V2) and angle(v3) (a1, a2, a3).

    Modify a2 and a3 (add 2*pi if needed) so that

    a1 <= a2 < a1 + 2*pi
    a1 <= a3 < a1 + 2*pi
    

    Now you simply have to compare a2 and a3. V3 is between V1 and V2 is resulting a3 is inferior to a2.

提交回复
热议问题