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

View source: R/mesh_3d.R

as.triangles3d.fm_mesh_3dR Documentation

Convert a 3D mesh to a 3D rgl triangulation

Description

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

Usage

as.triangles3d.fm_mesh_3d(obj, subset = NULL, ...)

Arguments

obj

An fm_mesh_3d object

subset

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

...

Currently unused

Value

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

Examples

# Protect against unavailable rgl device by only running interactively
if (interactive() &&
  requireNamespace("geometry", quietly = TRUE) &&
  requireNamespace("rgl", quietly = TRUE)) {
  (m <- fm_delaunay_3d(matrix(rnorm(30), 10, 3)))
  rgl::open3d()
  rgl::triangles3d(rgl::as.triangles3d(m, "boundary"), col = "blue")
  rgl::axes3d()
}


fmesher documentation built on Feb. 19, 2026, 9:07 a.m.