R/bounding-box-xy.R

Defines functions bounding_box_xy

Documented in bounding_box_xy

#' Compute the bounding window from coordinates
#' 
#' @param x Columnwise matrix of coordinates, n-dimensional.
#' 
#' @details
#' Rectangular or cuboidal bounding box around coordinates given as
#' matrix 'x'. Enlarged with the Ripley and Rasson 1977 method.
#' 
#' @export

bounding_box_xy <- function(x) {
  n <- nrow(x)
  f <- (n+1)/(n-1)
  bb0 <- apply(x, 2, range)
  ce <- apply(bb0, 2, mean)
  bb1 <- t(t(bb0)-ce)
  bb2  <- bb1 * f
  t(t(bb2)+ce)
}

Try the SGCS package in your browser

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

SGCS documentation built on May 1, 2019, 8:20 p.m.