Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Created August 28, 2024 11:14
Show Gist options
  • Save mdsumner/8db5ac01e47fa86f10e7ebc372e0ebda to your computer and use it in GitHub Desktop.
Save mdsumner/8db5ac01e47fa86f10e7ebc372e0ebda to your computer and use it in GitHub Desktop.
sfx <- silicate::inlandwaters[6, ]
## devtools::install_github("hypertidy/anglr") ## in desperate need of reboot, alignment with wk/geos etc. 
ps <- anglr::as_pslg(sfx)
tr <- triangulate(ps)
plot(tr$VP, pch = ".")
plot(tr, add = TRUE)
points(tr$VP, pch = "+")
E <- tr$VE[tr$VE[,2] > 0, ]
lines(tr$VP[t(cbind(E, NA)), ], col = "red", lwd = 2)
@mdsumner
Copy link
Author

all with terra

    ## do it all with terra
    library(terra)
#> terra 1.7.81
    f <- system.file("ex/lux.shp", package="terra")
    v <- vect(f)
    vo <- voronoi(v)
    
        
plot(intersect(v, vo))

plot(intersect(aggregate(v), voronoi(aggregate(v))))

Created on 2024-08-29 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment