Learn R Programming

Rvcg (version 0.12.2)

vcgUpdateNormals: 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
  • vb4 x n matrix containing coordinates (as homologous coordinates
  • normals4 x n matrix containing normals (as homologous coordinates

Examples

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

require(Morpho)
plotNormals(pointcloud)#plot normals

Run the code above in your browser using DataLab