Angle between two points


Is the easy way to get angle between points like Vector2(0, 0) and Vector2(3, 3) ?

Dot product of normalized vectors is cosine of angle between them.

As @orefkov indicated, dot product gives you the angle between two vectors. Your example here, though, with one of the points being Vector2(0,0) indicates you might actually be looking for the angle of the line formed by the two points. In this case, a solution would be to subtract the first point from the second, then use Atan2 on the result Vector2’s components (x,y) to calculate the angle of the line.

Vector2 A(0,0), B(3,3);
Vector2 C=B-A;
float angle=Atan2(C.y_, C.x_);

Thank you so much. I have already spent several nights solving this problem. Thank !