Learn R Programming

Morpho (version 1.0-1)

ply2mesh: Import 3D surface mesh files

Description

imports 3D mesh files and store them as an R .object of class mesh3d

Usage

ply2mesh(filename, adnormals = TRUE,readnormals = FALSE,readcol=FALSE, silent = FALSE )
obj2mesh(filename, adnormals = TRUE)
file2mesh(filename, clean = TRUE,readcol=FALSE)

Arguments

filename
character: path to file
adnormals
Logical: If the file does not contain normal information, they will be calculated in R: Can take some time.
readnormals
Logical: Import vertex normals (if available), although no face information is present.
readcol
Logical: Import vertex colors (if available).
clean
Logical: Delete dumpfiles.
silent
logical: suppress messages.

Value

  • meshlist of class mesh3d - see rgl manual for further details, or a matrix containing vertex information or a list containing vertex and normal information

Details

file2mesh needs the command line tool ply2ascii from the Auxiliaries section in http://sourceforge.net/projects/morpho-rpackage/files/Auxiliaries/ installed.

Examples

Run this code
data(nose)
mesh2ply(shortnose.mesh)
mesh <- ply2mesh("shortnose.mesh.ply")

mesh2obj(shortnose.mesh)
mesh2 <- obj2mesh("shortnose.mesh.obj")

Run the code above in your browser using DataLab