[R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)

Adrian Baddeley adrian.baddeley at curtin.edu.au
Sat Jul 9 12:38:07 CEST 2016


Tina Cormier <TinaACormier at gmail.com> wrote:

> I'd like to create a circle around each cluster that is
> the smallest circle that would encompass all 4 points.

The circumcircle.

Try the following:

<https://dl.dropboxusercontent.com/u/72421241/test_subplotsToPlots.zip><https://stat.ethz.ch/mailman/listinfo/r-sig-geo>library(spatstat)

circumcircle <- function(x, ...) {   UseMethod("circumcircle") }

circumcircle.owin <- function(x, ...) {
  d2 <- fardist(x, ..., squared=TRUE)
  z <- where.min(d2)
  r <- sqrt(min(d2))
  w <- disc(centre=z, radius=r)
  return(w)
}

circumcircle.ppp <- function(x, ...) {
  circumcircle(convexhull(x))
}


Adrian Baddeley

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list