vcgImport: Import common mesh file formats.

View source: R/vcgImport.r

vcgImportR Documentation

Import common mesh file formats.

Description

Import common mesh file formats and store the results in an object of class "mesh3d" - momentarily only triangular meshes are supported.

Usage

vcgImport(
  file,
  updateNormals = TRUE,
  readcolor = FALSE,
  clean = TRUE,
  silent = FALSE
)

Arguments

file

character: file to be read.

updateNormals

logical: if TRUE and the imported file contais faces, vertex normals will be (re)calculated. Otherwise, normals will be a matrix containing zeros.

readcolor

if TRUE, vertex colors and texture (face and vertex) coordinates will be processed - if available, otherwise all vertices will be colored white.

clean

if TRUE, duplicated and unreferenced vertices as well as duplicate faces are removed (be careful when importing point clouds).

silent

logical, if TRUE no console output is issued.

Value

Object of class "mesh3d"

with:

vb

4 x n matrix containing n vertices as homolougous coordinates

it

3 x m matrix containing vertex indices forming triangular faces

normals

4 x n matrix containing vertex normals (homologous coordinates)

in case the imported files contains face or vertex quality, these will be stored as vectors named $quality (for vertex quality) and $facequality

if the imported file contains vertex colors and readcolor = TRUE, these will be saved in $material$color according to "mesh3d" specifications.

Note

currently only meshes with either color or texture can be processed. If both are present, the function will mark the mesh as non-readable.

Author(s)

Stefan Schlager

See Also

vcgSmooth

Examples

data(humface)
vcgPlyWrite(humface)
readit <- vcgImport("humface.ply")

zarquon42b/Rvcg documentation built on April 11, 2024, 3:17 a.m.