Learn R Programming

MeshesTools (version 1.0.0)

meshVolume: Mesh volume

Description

Computes the volume bounded by a mesh.

Usage

meshVolume(mesh)

Value

A number, the volume bounded by the mesh.

Arguments

mesh

a mesh given either as a list containing (at least) the two fields vertices (numeric matrix with three columns) and faces (integer matrix or list of integer vectors), otherwise as a rgl mesh (i.e. a mesh3d object)

Examples

Run this code
library(MeshesTools)
R <- 4; r <- 2
mesh <- torusMesh(R, r)
meshVolume(mesh)
# true volume of the torus: 
2 * pi^2 * R * r^2

Run the code above in your browser using DataLab