From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Math Object
The atan() method returns the arctangent of a number as a numeric value between -PI/2 and PI/2 radians.
The atan2() method returns the angle theta of an (x,y) point as a numeric value between -PI and PI radians.
|
Math.atan(x) Math.atan2(x,y) |
| Parameter | Description |
|---|---|
| x | Required. A number |
| y | Required. A number |
Example 1 - atan()Return the arctangent of different numbers with the atan() method:
The output of the code above will be:
Try it yourself » |
Example 2 - atan2()Return the angle theta of different (x,y) points with the atan2() method:
The output of the code above will be:
Try it yourself » |
JavaScript Math Object
From http://www.w3schools.com (Copyright Refsnes Data)