R/withinRadius.R

Defines functions withinRadius

#' Test whether point "b" is within a given radius of point "a".
#'
#' @param a Numeric. Data frame of x-y coordinates.
#' @param b Numeric. Data frame of x-y coordinates.
#' @param radius Numeric.
#' @noRd

withinRadius <- function(a, b, radius = 2) {
  (a[, 1] - b[, 1])^2 + (a[, 2] - b[, 2])^2 <= radius^2
}
lindbrook/cholera documentation built on June 14, 2025, 8:44 p.m.