mesh_from_rgl: Convert an rgl tmesh3d to scimesh mesh format

View source: R/mesh_utils.R

mesh_from_rglR Documentation

Convert an rgl tmesh3d to scimesh mesh format

Description

Extracts vertices and triangle indices from an rgl tmesh3d object into the format expected by render_mesh(). Does not require the rgl package – any list with components vb (4xN homogeneous coordinates) and it (3xM index matrix) works.

Usage

mesh_from_rgl(tmesh)

Arguments

tmesh

A list with components vb and it, as produced by rgl::tmesh3d().

Value

A mesh descriptor list with vertices (Nx3) and triangles (Mx3, 1-based indices).

Examples

fake <- list(vb = rbind(0:3, 0:3, 0:3, rep(1, 4)),
             it = matrix(1:6, nrow = 3))
m <- mesh_from_rgl(fake)
m$vertices
m$triangles


scimesh documentation built on Aug. 9, 2026, 9:07 a.m.