Learn R Programming

Morpho (version 2.1)

unrefVertex: some little helpers for vertex operations on triangular meshes

Description

some little helpers for vertex operations on triangular meshes

Usage

unrefVertex(mesh)

rmVertex(mesh, index, keep = FALSE)

vert2points(mesh)

rmUnrefVertex(mesh, silent = FALSE)

Arguments

mesh
triangular mesh of class mesh3d.
index
vector containing indices of vertices to be removed.
keep
logical: if TRUE, the vertices specified by index are kept and the rest is removed.
silent
logical: suppress output about info on removed vertices.

Value

  • unrefVertex: vector with indices of unreferenced vertices.

    rmVertex: returns mesh with specified vertices removed and faces and normals updated.

    vert2points: k x 3 matrix containing vertex coordinates.

    rmUnrefVertex: mesh with unreferenced vertices removed.

Details

extract vertex coordinates from meshes, find and/or remove (unreferenced) vertices from triangular meshes

unrefVertex finds unreferenced vertices in triangular meshes of class mesh3d.

rmVertex removes specified vertices from triangular meshes.

vert2points extacts vertex coordinates from triangular meshes.

rmUnrefVertex removes unreferenced vertices from triangular meshes.

See Also

ply2mesh, file2mesh

Examples

Run this code
require(rgl)
data(nose)
testmesh <- rmVertex(shortnose.mesh,1:50) ## remove first 50 vertices
shade3d(testmesh,col=3)### view result
testmesh$vb <- cbind(testmesh$vb,shortnose.mesh$vb[,1:50]) ## add some unreferenced vertices
points3d(vert2points(testmesh),col=2)## see the vertices in the holes?
cleanmesh <- rmUnrefVertex(testmesh)## remove those lonely vertices!
rgl.pop()
points3d(vert2points(cleanmesh),col=2) ### now the holes are empty!!

Run the code above in your browser using DataLab