bevy_math::ops

Function atan2

Source
pub fn atan2(x: f32, y: f32) -> f32
Available on non-crate feature libm only.
Expand description

Computes the four quadrant arctangent of self (y) and other (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.