Skip to contents

Maps angles in radians to the half-open interval \([-\pi, \pi)\).

Usage

wrap_angle(theta)

Arguments

theta

Numeric vector of angles in radians.

Value

Numeric vector of wrapped angles.

Examples

wrap_angle(c(0, 3 * pi / 2, -3 * pi / 2, 7))
#> [1]  0.0000000 -1.5707963  1.5707963  0.7168147