[R-sig-Geo] Find incircle of a polygon

Etienne Bellemare Racine etiennebr at gmail.com
Wed Apr 22 22:51:26 CEST 2009


Thanks Roger it helped me a lot.
Now I would like to iteratively find the incircle in a polygon until a 
certain radii (i.e. as if I was stuffing balls in my polygon, from the 
biggest to the smallest). So I have to subtract that circle to my polygon.
Should I subtract it from my polygon by adding an inside loop (setting 
hole to TRUE, is it that simple) or can I substract it directly from the 
owin object ?

Thanks,
Etienne

Roger Bivand a écrit :
> On Wed, 22 Apr 2009, Etienne Bellemare Racine wrote:
>
>> Hi,
>> I'm looking for a way to find the largest circle fitting in an irregular
>> polygon. This is not the real definition of an incircle (as it has to be
>> tangent to all edges, but it's a more synthetic title).
>> Spatstat package has an incircle function, but designed for an owin
>> class object. Before trying to adapt the function to my needs, so I can
>> input a shapefile, I would be happy to get some advices (if any
>> available), or another package to look at.
>
> You can read (polygon) shapefiles into SpatialPolygon* objects using 
> readShapeSpatial in maptools and readOGR in rgdal. Once there, coerce 
> to an owin object with methods in maptools, something like:
>
> x <- readOGR(".", "myshape")
> ox <- as(as(x, "SpatialPolygons"), "owin")
>
> should do it, but watch for topology checking in spatstat. Spatstat 
> ships with a vignette on using shapefiles, see for an online link:
>
> http://cran.r-project.org/web/packages/spatstat/vignettes/shapefiles.pdf
>
> which is up to date, humourous, and should tell you what you need to 
> know. Using the advice there should resolve any topology problems. If 
> you are stuck after trying things from there, please follow up on this 
> list.
>
> Hope this helps,
>
> Roger
>
>>
>> Thanks,
>> Etienne
>>
>>     [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>



More information about the R-sig-Geo mailing list