[R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)
Bacou, Melanie
mel at mbacou.com
Sun Jul 10 02:50:53 CEST 2016
Interesting problem, it seems the exact approach is given by Fischer,
2003 and is implemented in a C++ CGAL package (see
http://stackoverflow.com/questions/9063453/how-to-compute-the-smallest-bounding-sphere-enclosing-other-bounding-spheres).
I haven't found any binding for R, but there's an implementation in
PostGIS `ST_MinimumBoundingCircle()` (see
http://postgis.net/docs/ST_MinimumBoundingCircle.html).
Others might be more up to date.
--Mel.
On 7/9/2016 6:38 AM, Adrian Baddeley wrote:
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
More information about the R-sig-Geo
mailing list