, gdistance, . , , , 16 ( ). , 2% ( ) .
library(maptools)
library(gdistance)
Pts <- as(test.ppp, "SpatialPoints")
Poly <- as(bound, "SpatialPolygons")
R <- raster(extent(Poly), nrow=100, ncol=100)
RR <- rasterize(Poly, R)
RR[is.na(RR)]<-0
tr1 <- transition(RR, transitionFunction=mean, directions=16)
tr1 <- geoCorrection(tr1,type="c")
costDistance(tr1, Pts)
plot(RR)
plot(Pts, pch=16, col="gold", cex=1.5, add=TRUE)
SL12 <- shortestPath(tr1, Pts[1,], Pts[2,], output="SpatialLines")
SL13 <- shortestPath(tr1, Pts[1,], Pts[3,], output="SpatialLines")
SL23 <- shortestPath(tr1, Pts[2,], Pts[3,], output="SpatialLines")
lapply(list(SL12, SL13, SL23), function(X) plot(X, col="red", add=TRUE, lwd=2))
