Angle between two Vectors 2D

前端 未结 8 1864
深忆病人
深忆病人 2021-02-05 17:29

I\'m trying to compute the angle between two vectors. I tried this, but it always returns zero:

public double GetAngle(Vector2 a, Vector2 b)
{
double angle = Mat         


        
8条回答
  •  离开以前
    2021-02-05 17:57

    since you use vector2 class, I guess you can use

    a-b

    to get the vector from a to b.

    so the angle you need is: Pi - angle(a-b).

提交回复
热议问题