Vec2:angle

Returns the angle between vectors.


angle = Vec2:angle(u)

Arguments

NameTypeDescription
uVec2 The other vector.

Returns

NameTypeDescription
anglenumber The angle to the other vector, in radians.

angle = Vec2:angle(x, y)

Arguments

NameTypeDescription
xnumber The x component of the other vector.
ynumber The y component of the other vector.

Returns

NameTypeDescription
anglenumber The angle to the other vector, in radians.

Notes

If any of the two vectors have a length of zero, the angle between them is not well defined. In this case the function returns math.pi / 2.

See also