hullMesh: Mesh of a 3d convex hull

View source: R/hullMesh.R

hullMeshR Documentation

Mesh of a 3d convex hull

Description

Extract the vertices and the faces from a 3d convex hull.

Usage

hullMesh(hull, simplify = TRUE, rgl = FALSE)

Arguments

hull

a 3d convex hull, output of cxhull

simplify

Boolean, whether to return the faces as a matrix instead of a list if possible, i.e. if all faces have the same number of edges; this argument is possibly ignored if rgl=TRUE, see below

rgl

Boolean, whether to return a rgl mesh (class mesh3d) if possible, i.e. if each face has three or four edges; if TRUE and the rgl mesh is possible, then the simplify argument has no effect

Value

A list giving the vertices and the faces, or a rgl mesh.

Note

Unless all faces are triangular, the output does not define a mesh with coherently oriented faces.

Examples

library(cxhull)
hull <- cxhull(daVinciSphere)
septuaginta <- hullMesh(hull, rgl = TRUE)
library(rgl)
open3d(windowRect = c(50, 50, 562, 562))
shade3d(septuaginta, color = "darkred")
# some quad faces are misoriented:
open3d(windowRect = c(50, 50, 562, 562))
shade3d(septuaginta, color = "tomato", back = "culled")

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