R/angular_distance.R

Defines functions angular_distance

#' @keywords internal
#' @noRd
#'
# Shortest angular distance between two directions on the circle.
angular_distance <- function(a1, a2) {
  d <- abs(a1 - a2)
  pmin(d, 2*pi - d)
}

Try the bpDir package in your browser

Any scripts or data that you put into this service are public.

bpDir documentation built on Nov. 9, 2026, 9:07 a.m.