powered by
pnp
Based on this solution: Copyright (c) 1970-2003, Wm. Randolph Franklin https://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
pnp(vertx, verty, testx, testy)
pnpmulti
df <- data.frame( x = c(1,1,2,2), y = c(1,2,1,2) ) pnp(df$x, df$y, 1.5, 1.5) pnp(df$x, df$y, 2.5, 2.5) # caution: false-negatives in edge-cases: pnp(df$x, df$y, 2, 1.5)
Run the code above in your browser using DataLab