EdgesAB {cxhull} | R Documentation |
Edges of a triangulated 3D convex hull given by the ids of the vertices in a matrix, plus a column indicating the border edges.
EdgesAB(hull)
hull |
an output of |
A character matrix with three columns. Each row provides the ids of the two vertices of an edge, and a yes/no indicator of whether the edge is a border edge.
library(cxhull)
library(rgl)
dodecahedron <- t(dodecahedron3d()$vb[-4L, ])
hull <- cxhull(dodecahedron, triangulate = TRUE)
triangles <- TrianglesXYZ(hull)
triangles3d(triangles, color = "yellow")
edges <- EdgesAB(hull)
trueEdges <- edges[edges[, 3L] == "yes", c(1L, 2L)]
otherEdges <- edges[edges[, 3L] == "no", c(1L, 2L)]
vertices <- VerticesXYZ(hull)
for(i in 1:nrow(trueEdges)){
lines3d(vertices[trueEdges[i, ], ], color = "blue", lwd = 3)
}
for(i in 1:nrow(otherEdges)){
lines3d(vertices[otherEdges[i, ], ], color = "red", lwd = 3)
}