bevy_math::ops

Function atan2

source
pub fn atan2(y: f32, x: f32) -> f32
Expand description

Computes the four-quadrant arctangent of y and x in radians.

  • x = 0, y = 0: 0
  • x >= 0: arctan(y/x) -> [-pi/2, pi/2]
  • y >= 0: arctan(y/x) + pi -> (pi/2, pi]
  • y < 0: arctan(y/x) - pi -> (-pi, -pi/2)

Precision is specified when the libm feature is enabled.