Learn R Programming

fmesher (version 0.3.0)

as.triangles3d.fm_mesh_3d: Convert a 3D mesh to a 3D rgl triangulation

Description

Extracts a matrix of coordinates of triangles, suitable for passing to rgl::triangles3d().

Usage

# S3 method for fm_mesh_3d
as.triangles3d(obj, subset = NULL, ...)

Value

A 3-column matrix of coordinates of triangles, suitable for passing to rgl::triangles3d().

Arguments

obj

An fm_mesh_3d object

subset

Character string specifying which triangles to extract. Either "all" (default) or "boundary".

...

Currently unused

Examples

Run this code
if (FALSE) { # interactive()
if (requireNamespace("geometry", quietly = TRUE) &&
  requireNamespace("rgl", quietly = TRUE)) {
  (m <- fm_delaunay_3d(matrix(rnorm(30), 10, 3)))
  rgl::open3d()
  rgl::triangles3d(as.triangles3d(m, "boundary"), col = "blue")
}
}

Run the code above in your browser using DataLab