Hello everyone,
I am working with spatial polygon and using SP and RGEOS package. I am
having
problem to find the maximum-distance intersect points with spokes (drawn
from a kind of centroid) and the polygon boundary.
Thanks,
Kaushik
*Here is the details steps:*
Consider a 2-D polygon (with no holes) with the vertices
I am drawing equi-angled (around 360 degree of the centre) spokes from the
above centre to the vertices of the polygon.
*Here is my R-code to draw the spokes:*
n=50 # Number of equi angled spokes from center
xcent = cent_0[1]
ycent = cent_0[2]
cent = sp::SpatialPoints(cbind(xcent, ycent))
pts = sp::SpatialPoints(X)
## take the furthest distance from centre to vertex, times two!
r = 2 * max(sp::spDistsN1(pts, cent))
theta=seq(0,2*pi,length=n+1)[-(n+1)]
## construct a big wheel of spoke lines
sl = sp::SpatialLines(lapply(1:length(theta),function(id){
t = theta[id]
sp::Lines(list(sp::Line(rbind(c(xcent, ycent),c(xcent + r * cos(t),ycent +
r * sin(t))))),ID=id)}))
## construct the polygon as a SpatialPolygons object:
>spokes
I want to have the maximum-distance intersect points with the spokes and
the polygon boundary. If a spoke (corresponding to a specific angle) don't
intersect the boundary of the polygon then we take the intersect point as
the centre itself for that angle.
So finally I want to have *n *boundary points on the (one for each angle)
polygon which obtained from the above scheme.
Stuck here in doing this.
Any suggestions!!