Learn R Programming

Rvcg (version 0.24)

vcgClean: Clean triangular surface meshes

Description

Apply several cleaning algorithms to surface meshes

Usage

vcgClean(mesh, sel = 0, tol = 0, silent = FALSE, iterate = FALSE)

Value

cleaned mesh with an additional entry

remvert

vector of length = number of vertices before cleaning. Entries = 1 indicate that this vertex was removed; 0 otherwise.

Arguments

mesh

triangular mesh of class 'mesh3d'

sel

integer vector selecting cleaning type (see "details"),

tol

numeric value determining Vertex Displacement Ratio used for splitting non-manifold vertices.

silent

logical, if TRUE no console output is issued.

iterate

logical: if TRUE, vcgClean is repeatedly run until nothing more is to be cleaned (see details).

Details

the vector sel determines which operations are performed in which order. E.g. removing degenerate faces may generate unreferenced vertices, thus the ordering of cleaning operations is important, multiple calls are possible (sel=c(1,3,1) will remove unreferenced vertices twice). available options are:

  • 0 = only duplicated vertices and faces are removed

  • 1 = remove unreferenced vertices

  • 2 = Remove non-manifold Faces

  • 3 = Remove degenerate faces

  • 4 = Remove non-manifold vertices

  • 5 = Split non-manifold vertices by threshold

  • 6 = merge close vertices (radius=tol)

  • 7 = coherently orient faces

    CAVEAT: sel=6 will not work keep vertex colors

Examples

Run this code
data(humface)
cleanface <- humface
##add duplicated faces
cleanface$it <- cbind(cleanface$it, cleanface$it[,1:100])
## add duplicated vertices
cleanface$vb <- cbind(cleanface$vb,cleanface$vb[,1:100])
## ad unreferenced vertices
cleanface$vb <- cbind(cleanface$vb,rbind(matrix(rnorm(18),3,6),1))
cleanface <- vcgClean(cleanface, sel=1)

Run the code above in your browser using DataLab