Learn R Programming

Morpho (version 2.12)

updateNormals: Compute face or vertex normals of a triangular mesh

Description

Compute face or vertex normals of a triangular mesh of class "mesh3d"

Usage

updateNormals(x, angle = TRUE)

facenormals(x)

Value

updateNormals returns mesh with updated vertex normals.

facenormals returns an object of class "mesh3d" with

vb

faces' barycenters

normals

faces' normals

Arguments

x

triangular mesh of class "mesh3d"

angle

logical: if TRUE, angle weighted normals are used.

Author

Stefan Schlager

References

Baerentzen, Jakob Andreas. & Aanaes, H., 2002. Generating Signed Distance Fields From Triangle Meshes. Informatics and Mathematical Modelling, .

See Also

ply2mesh

Examples

Run this code

require(rgl)
require(Morpho)
data(nose)
### calculate vertex normals
shortnose.mesh$normals <- NULL ##remove normals
if (FALSE) {
shade3d(shortnose.mesh,col=3)##render
}
shortnose.mesh <- updateNormals(shortnose.mesh)
if (FALSE) {
clear3d()
shade3d(shortnose.mesh,col=3)##smoothly rendered now
}
## calculate facenormals
facemesh <- facenormals(shortnose.mesh)
if (FALSE) {
plotNormals(facemesh,long=0.01)
points3d(vert2points(facemesh),col=2)
wire3d(shortnose.mesh)
}

Run the code above in your browser using DataLab