Home

atan2ny

atan2ny is a two-argument arctangent function used in mathematics and computing to determine the angle of a two-dimensional vector with components n and y relative to the positive n-axis. The function returns an angle, typically in radians, though some implementations provide degrees as an alternative. The value is usually given in the principal range, such as (-π, π] or (-180°, 180°).

Inputs are the real numbers n and y, representing the horizontal and vertical components of the vector

Relation to related functions depends on convention. The standard two-argument arctangent, atan2, is defined as atan2(y,

Edge cases include when n = 0 and y = 0, where the angle is often undefined or defined

Applications of atan2ny appear in fields such as computer graphics, robotics, navigation, and any domain requiring

(n,
y),
respectively.
The
computed
angle
is
the
direction
from
the
positive
n-axis
to
the
vector,
effectively
locating
the
vector
in
the
plane.
x).
If
atan2ny
is
defined
as
atan2(y,
n),
then
atan2ny(n,
y)
becomes
equivalent
to
atan2(y,
n)
with
the
arguments
swapped.
If
instead
atan2ny
is
defined
as
atan2(n,
y),
the
resulting
angle
corresponds
to
a
90-degree
rotation
relative
to
the
standard
convention.
Because
conventions
vary
by
library
or
domain,
the
precise
mapping
should
be
confirmed
in
the
relevant
documentation.
by
a
chosen
convention.
If
n
=
0
and
y
>
0,
the
angle
is
typically
π/2;
if
n
=
0
and
y
<
0,
it
is
-π/2.
When
n
>
0,
the
angle
is
arctan(y/n)
adjusted
for
the
correct
quadrant;
when
n
<
0,
the
result
is
adjusted
by
adding
or
subtracting
π
as
appropriate.
robust
representation
of
a
vector’s
direction.