EdgesAB {cxhull} | R Documentation |
Edges of a triangulated 3D convex hull
Description
Edges of a triangulated 3D convex hull given by the ids of the vertices in a matrix, plus a column indicating the border edges.
Usage
EdgesAB(hull)
Arguments
hull |
an output of |
Value
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.
Examples
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)
}
[Package cxhull version 0.7.4 Index]