Method

# ATan2

## Description

Returns the arctangent of the point whose coordinates are x and y. The arctangent is the angle from the x-axis to a line drawn through the origin (0,0) and a point with coordinates x, y.

## Usage

```result = ATan2(y, x)
```

Part

Type

Description

result

Double

Arctangent of the point (y, x) in radians.

y

Double

y coordinate of the point.

x

Double

x coordinate of the point.

## Notes

The result is expressed in radians. To convert it to degrees, multiply it by 180/PI.

The converse operations are done with Cos and Sin. That is, if you have an angle and want to find an x, y pair along the line described by 0,0 and x,y, you can do so with:

```x = Cos(angle) * radius
```

## Sample code

This example uses the ATan2 function to return the arctangent of a point directly above the origin.

```Var d As Double
Const Pi = 3.14159265358979323846264338327950
d = ATan2(1, 0) ' returns 1.57
d = ATan2(1, 0) * 180 / PI ' returns 90
```

## Compatibility

All project types on all supported operating systems.