EdgesAB: Edges of a triangulated 3D convex hull

View source: R/cxhull.R

EdgesABR 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 cxhull applied to 3D points and with the option triangulate=TRUE

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)
}

cxhull documentation built on Oct. 24, 2023, 9:07 a.m.