The atan2() is an inbuilt function in Ruby returns angent inverse of (y/x), where y is the proportion of the y-coordinate and x is the proportion of the x-coordinate. The numeric value lies between –pi and +pi representing the angle theta of a (x, y) point and positive x-axis. It is the counterclockwise angle, measured in radian, between the positive X-axis, and the point (x, y).
Syntax: Math.atan2(y, x)
Parameters: The function accepts x and y coordinates.
Return Value: It returns returns a numeric value between –pi and +pi representing the angle theta of a (x, y) point and positive x-axis