vcgVolume: Compute volume for manifold meshes

View source: R/vcgVolume.r

vcgVolumeR Documentation

Compute volume for manifold meshes

Description

Compute volume for manifold meshes

Usage

vcgVolume(x)

Arguments

x

triangular mesh of class mesh3d

Value

returns volume

Note

Please note, that this function only works reliably on watertight, coherently oriented meshes that constitute a manifold. In case your mesh has some issues regarding non-manifoldness or there are isolated pieces flying around, you can use vcgIsolated and vcgClean to remove those.

Examples

mysphere <- vcgSphere()
vcgVolume(mysphere)
## Not run: 
## here is an example where the mesh has some non-manifold vertices

mysphere <- vcgSphere(normals=FALSE)
## add a degenerate face
mysphere$it <- cbind(mysphere$it,c(1,2,1))
try(vcgVolume(mysphere))

## fix the error using vcgClean():
vcgVolume(vcgClean(mysphere,sel=0:6,iterate=TRUE))

## End(Not run)



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