atan2 Function |
Top Previous Next |
Returns the arctangent of the quotient of its arguments, as a numeric value between PI and -PI radians. SyntaxMath.atan2(number2, number1) Arguments
Return ValueA number which represents the counterclockwise angle in radians between the positive X axis and the point (number1, number2). The function returns NaN when given a NaN argument. RemarksThe order of arguments is reversed; the function atan2(y, x) computes the angle corresponding to the point (x, y). ExamplesMath.atan2(0,1); // Returns 0 Math.atan2(0,0); // Returns 0 Math.atan2(-1000,0); // Returns -1.570796 Math.atan2(-10000, -1000); // Returns -1.670465 See also |