Returns the planar angle measured from the positive x-axis towards the
positive y-axis, in (-pi, pi]. That is the signed range the animovement
suite uses for every direction (see anicore::wrap_angle()), and the one
atan2() gives, except that a point on the negative x-axis is pi, never
-pi. For [0, 2 * pi), wrap the result with
anicore::wrap_angle(phi, "2pi").
See also
Other coordinate conversion:
cartesian_to_rho(),
cartesian_to_theta(),
polar_to_x(),
polar_to_y(),
spherical_to_z()
Examples
cartesian_to_phi(1, 1)
#> [1] 0.7853982
# Below the x-axis, the azimuth is negative
cartesian_to_phi(-1, -1)
#> [1] -2.356194
# On the negative x-axis, it is pi
cartesian_to_phi(-1, 0)
#> [1] 3.141593
# For [0, 2 * pi), wrap the result
anicore::wrap_angle(cartesian_to_phi(-1, -1), "2pi")
#> [1] 3.926991