JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Math.atan2() Function

Name

Math.atan2() Function---compute the angle from the X axis to a point

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

Math.atan2(x, y)

Arguments

x

The X-coordinate of the point.

y

The Y-coordinate of the point.

Returns

The counter-clockwise angle, measured in radians, between the positive X axis, and the point (x, y).

Description

The Math.atan2() function performs half of the conversion between Cartesian coordinates and polar coordinates. It computes and returns the angle theta of an (x, y) point.

This function is named Math.atan2() because it performs a similar computation to Math.atan(). Math.atan2() is passed separate x and y arguments, and Math.atan() is passed the ratio of those two arguments.

See Also

"Math", "Math.atan()", "Math.tan()"


Previous Home Next
Math.atan() Book Index Math.ceil()

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
This HTML Help has been published using the chm2web software.