Closed mdsumner closed 6 years ago
This works, a hole in a polygon in isolation. Explore what breaks it some or a combination of
p1 <- cbind(x = c(0, 0, 0.75, 1, 0.5, 0.8, 0.69),
y = c(0, 1, 1, 0.8, 0.7, 0.6, 0))
p2 <- cbind(x = c(0.2, 0.2, 0.3, 0.5, 0.5),
y = c(0.2, 0.4, 0.6, 0.4, 0.2))
pp <- rbind(p1, NA, p2)
library(rgl)
idx <- triangulate(pp[,1], pp[,2])
rgl.clear()
apply(idx, 2, function(i) rgl.triangles(cbind(pp[i, ], 0)))
rglwidget()
Turns out I sent this to the rgl author about a year ago, I assume it's considered to be user-fault:
Hello,
rgl::triangulate fails on a multi-island input, though the help suggests this should be possible?
library(rgl)
## two distinct polygons
x1 <- cbind(c(0, 0, 1, 1), c(0, 1, 1, 0))
x2 <- cbind(c(1.1, 1.1, 2, 2),
c(0, 1, 1, 0))
#plot(rbind(x1, x2))
#polypath(rbind(x1, NA, x2))
rgl::triangulate(rbind(x1, NA, x2))
Error in nesting$nesting[[fwd]] : subscript out of bounds
It seems the nesting logic isn't there for distinct rings that are not "holes"?
Cheers, Mike.
This is caused by not separating neighbouring polygons, I think rgl's nesting-detection logic is not robust to shared edges.
the translator vignette needs ear clipping to demonstrate the differences with delaunay-constrained
Why does the nesting in the examples work but not with minimal_mesh?
(is it the shared boundary across features?)