hypertidy/silicate

another CGAL option

Opened this issue · 1 comments

at this point the the exploding number of CGAL packages on CRAN, probably just dig into the impl and diy

 x <- cgalPolygonWithHoles$new(head(silicate::minimal_mesh$geom[[1]][[1]][[1]], -1), list(head(silicate::minimal_mesh$geom[[1]][[1]][[2]], -1)))
plot(silicate::minimal_mesh)
lapply(x$convexParts("triangle"), polypath)

image

plot(anglr::DEL0(silicate::minimal_mesh))

image

and for bigger stuff

well I don't believe this is right

remove_n <- function(x) {
if (is.recursive(x)) return(lapply(x, remove_n) )
head(x, -1)
}
g <- remove_n(silicate::inlandwaters$geom[[5]][[2]])
g <- list(g[[1]], g[-1])
x <- do.call(cgalPolygonWithHoles$new, g)
x$convexParts()

Error: Found two holes intersecting each other

wip, but removing the offending holes (just keep one of them) gives

image