readMeshFile: Read a mesh file

View source: R/ReadWrite.R

readMeshFileR Documentation

Read a mesh file

Description

Read mesh vertices and faces from a file.

Usage

readMeshFile(filepath)

Arguments

filepath

path to the mesh file; supported formats are stl, ply, obj and off

Value

A list with two fields: vertices, a numeric matrix with three columns, and faces, either a list of integer vectors or, in the case if all faces have the same number of sides, an integer matrix.

Examples

library(MeshesOperations)
library(rgl)
vf <- readMeshFile(
  system.file("extdata", "beethoven.ply", package = "MeshesOperations")
)
mesh <- Mesh(
  vf[["vertices"]], vf[["faces"]], normals = TRUE, clean = TRUE
)
rglmesh <- toRGL(mesh)
open3d(windowRect = c(50, 50, 562, 562))
view3d(0, 0, zoom = 0.8)
shade3d(rglmesh, color = "palevioletred")

stla/MeshesOperations documentation built on Oct. 23, 2022, 8:23 a.m.