toRGL: Conversion to 'rgl' mesh

View source: R/meshes.R

toRGLR Documentation

Conversion to 'rgl' mesh

Description

Converts a CGAL mesh (e.g. an output of the Mesh function) to a rgl mesh.

Usage

toRGL(mesh, ...)

Arguments

mesh

a CGAL mesh, that is to say a list of class "cgalMesh" (e.g. an output of the Mesh function); in order to be convertible to a rgl mesh, its faces must have at most four sides

...

arguments passed to mesh3d

Value

A rgl mesh, that is to say a list of class "mesh3d".

Examples

library(PolygonSoup)
library(rgl)
mesh <- Mesh(
  truncatedIcosahedron[["vertices"]], truncatedIcosahedron[["faces"]],
  triangulate = TRUE
)
rglmesh <- toRGL(mesh, segments = t(mesh[["edges"]]))
open3d(windowRect = c(50, 50, 562, 562), zoom = 0.9)
shade3d(rglmesh, color = "darkred")

PolygonSoup documentation built on Oct. 19, 2022, 5:13 p.m.