You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## triangulation: tristrip() returns a list where each element is a
## coordinate matrix of vertices of triangles
triangleSets<-gpclib::tristrip(polyregion)
However, the R package gpclib is unmaintained since 2013 and requires special treatment because of its non-standard license. Sooner or later we might have to switch to an alternative implementation (with support for non-convex polygons).
library("gpclib")
xygpc<- new("gpc.poly", pts=list(c(xypoly, list(hole=FALSE))))
xystrip<- tristrip(xygpc)
plot(xygpc)
lapply(xystrip, lines, lty=2)
## this gives quite a lot of triangles (over each of which we need to integrate)
sum(sapply(xystrip, function(x) nrow(x) -2)) # 29 triangles
interp::tri.mesh() (relatively fast Delaunay triangulation):
xymesh<-interp::tri.mesh(xypoly)
plot(xymesh); lines(xypoly, col=2, lwd=2)
nrow(interp::triangles(xymesh)) # 32 triangles## BUT: still need to find interior triangles
decido::earcut() (wraps earcut.hpp, which implements a modified ear slicing algorithm):
polyCub.exact.Gauss()
is based on polygon triangulation, currently viagpclib::tristrip()
:polyCub/R/polyCub.exact.Gauss.R
Lines 91 to 93 in 39ef504
However, the R package gpclib is unmaintained since 2013 and requires special treatment because of its non-standard license. Sooner or later we might have to switch to an alternative implementation (with support for non-convex polygons).
Simple non-convex example polygon:
gpclib::tristrip()
(current approach):interp::tri.mesh()
(relatively fast Delaunay triangulation):decido::earcut()
(wraps earcut.hpp, which implements a modified ear slicing algorithm):RTriangle::triangulate()
(non-commercial license):Runtimes:
Switch to decido?
decido::earcut()
...gpclib::tristrip()
earcut.hpp
...Alternative: RTriangle
The text was updated successfully, but these errors were encountered: