Oihana PHP Arango

atan2.php

Table of Contents

Functions

atan2()  : string
Return the arctangent of the quotient of y and x.

Functions

atan2()

Return the arctangent of the quotient of y and x.

atan2(string|int $y, string|int $x) : string

This helper wraps the ArangoDB AQL function ATAN2(y, x) which returns the arctangent of y/x in radians, using the signs of both arguments to determine the quadrant of the result. This is more accurate than ATAN(y/x) for determining the angle from the origin to a point.

Example AQL usage:

ATAN2(0, 1)   // returns 0
ATAN2(1, 1)   // returns 0.7853981633974483 (π/4)
ATAN2(1, 0)   // returns 1.5707963267948966 (π/2)
ATAN2(-1, -1) // returns -2.356194490192345 (-3π/4)
Parameters
$y : string|int

The y coordinate.

$x : string|int

The x coordinate.

Tags
example
use function oihana\arango\db\functions\numerics\atan2;

$expr = atan2(1, 1);
// Produces: 'ATAN2(1, 1)'
see
https://docs.arangodb.com/stable/aql/functions/numeric/#atan2
atan()

For the single-parameter arctangent.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results