Name
Math.atan2( ): compute the angle from the X axis to a point — ECMAScript v1
Synopsis
Math.atan2(y,
x)
Arguments
-
y The Y coordinate of the point.
-
x The X coordinate of the point.
Returns
A value between -π and π radians that specifies the
counterclockwise angle between the positive X axis and the point
(x,
y).
Description
The Math.atan2( ) function
computes the arc tangent of the ratio
y/x. The
y argument can be considered the Y
coordinate (or “rise”) of a point, and the
x argument can be considered the X
coordinate (or “run”) of the point. Note the unusual order of the
arguments to this function: the Y coordinate is passed before the X
coordinate.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access