Finding euclidean distance in R{spatstat} between points, confined by an irregular polygon window
I'm trying to find the euclidean distance between two points, confined by an irregular polygon. (ie. the distance would have to be calculated as a route through the window given) Here is an reproducible example: library(spatstat) #Simple example of a polygon and points. ex.poly <- data.frame(x=c(0,5,5,2.5,0), y=c(0,0,5,2.5,5)) points <- data.frame(x=c(0.5, 2.5, 4.5), y=c(4,1,4)) bound <- owin(poly=data.frame(x=ex.poly$x, y=ex.poly$y)) test.ppp <- ppp(x=points$x, y=points$y, window=bound) pairdist.ppp(test.ppp)#distance between every point #The distance result from this function between point 1