When I want to plot polygons using rgl, for certain coordinate pairs, I get an error:
# polygon data
xyz <- structure(c(5.90000000002328, 6, 6.20000000001164, 5.90000000002328,
12.2999999998137, 12.2999999998137, 12.2999999998137, 12.2999999998137,
7.45599365234375, 7.6009521484375, 7.7039794921875, 7.45599365234375
), dim = 4:3, dimnames = list(c("p1", "p2", "p3", "p1"), c("x",
"y", "Z")))
# plotting
polygon3d(
x = as.numeric(xyz[,1]),
y = as.numeric(xyz[,2]),
z = as.numeric(xyz[,3]), col = "red")
> Error in processOutside(i) : Cannot triangulate polygon
However, for other polygons, it works, e.g. for:
# working polygon
xyz <- structure(c(3.70000000001164, 3, 3.09999999997672, 3.70000000001164,
12.2999999998137, 12, 12, 12.2999999998137, 8.74200439453125,
8.91094970703125, 8.990966796875, 8.74200439453125), dim = 4:3, dimnames = list(
c("p1", "p2", "p3", "p1"), c("x", "y", "Z")))
I thought it might be because of the proximity of the points, but after multiplying the points with 100 or rounding decimal points, I still get an error. Why do I get this error? Does this have to do with too sharp angles?

