[R-sig-Geo] Minimum bounding circle from cluster of points (Tina Cormier)
chris english
englishchristophera at gmail.com
Sun Jul 10 14:44:20 CEST 2016
Mel,
Not a full implementation, but indicator of how one might do,
https://rforge.net/rcgal/git.html, that Simon Urbanek styles : rcgal - R
interface to a (small) subset of CGAL,
and has inside (function) that takes arbitrary shape files and x/y to say
inside or not.
CGAL is a darn fine library and I guess you'd pick and choose which parts
you'd wrap for your purposes.
Chris
On Sun, Jul 10, 2016 at 3:50 AM, Bacou, Melanie <mel at mbacou.com> wrote:
> 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
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list