# letter 'A'
v <- ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
edg <- cbind(1:4, 2:5)
edg <- rbind(edg, c(2,4))
letterA <- linnet(v, edges=edg)
plot(letterA)
di <- lineardisc(letterA, c(0,3), 1.6)
di
# count the endpoints more efficiently
countends(letterA, c(0,3), 1.6)
# cross-check
npoints(di$endpoints)
# measure the length more efficiently
lineardisclength(letterA, c(0,3), 1.6)
# cross-check
sum(lengths_psp(di$lines))
Run the code above in your browser using DataLab