vcgUpdateNormals: updates vertex normals of a triangular meshes or point clouds

View source: R/vcgUpdateNormals.r

vcgUpdateNormalsR Documentation

updates vertex normals of a triangular meshes or point clouds

Description

update vertex normals of a triangular meshes or point clouds

Usage

vcgUpdateNormals(mesh, type = 0, pointcloud = c(10, 0), silent = FALSE)

Arguments

mesh

triangular mesh of class 'mesh3d' or a n x 3 matrix containing 3D-coordinates.

type

select the method to compute per-vertex normals: 0=area weighted average of surrounding face normals; 1 = angle weighted vertex normals.

pointcloud

integer vector of length 2: containing optional parameters for normal calculation of point clouds. The first enty specifies the number of neighbouring points to consider. The second entry specifies the amount of smoothing iterations to be performed.

silent

logical, if TRUE no console output is issued.

Value

mesh with updated/created normals, or in case mesh is a matrix, a list of class "mesh3d" with

vb

4 x n matrix containing coordinates (as homologous coordinates

normals

4 x n matrix containing normals (as homologous coordinates

Examples

data(humface)
humface$normals <- NULL # remove normals
humface <- vcgUpdateNormals(humface)
## Not run: 
pointcloud <- t(humface$vb[1:3,]) #get vertex coordinates
pointcloud <- vcgUpdateNormals(pointcloud)

require(Morpho)
plotNormals(pointcloud)#plot normals

## End(Not run)

Rvcg documentation built on Feb. 16, 2023, 5:12 p.m.