Section 24.105. Math.atan2( ): compute the angle from the X axis to a point


24.105. Math.atan2( ): compute the angle from the X axis to a point

ECMAScript v1

24.105.1. Synopsis

Math.atan2(y, x)

24.105.1.1. Arguments

y

The Y coordinate of the point.


x

The X coordinate of the point.

24.105.1.2. Returns

A value between -π and π radians that specifies the counterclockwise angle between the positive X axis and the point (x, y).

24.105.2. 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.




JavaScript. The Definitive Guide
JavaScript: The Definitive Guide
ISBN: 0596101996
EAN: 2147483647
Year: 2004
Pages: 767

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net