# Examples from pyvista.ImageData.volume
# ======================================

# Get the volume of a cube of size 4x4x4.
# Note that there are 5 points in each direction.
import pyvista as pv
mesh = pv.ImageData(dimensions=(5, 5, 5))
mesh.volume

# A mesh with 2D cells has no volume.
mesh = pv.ImageData(dimensions=(5, 5, 1))
mesh.volume

# `pyvista.PolyData` is special as a 2D surface can
# enclose a 3D volume. This case uses a different methodology,
# see `pyvista.PolyData.volume()`.
mesh = pv.Sphere()
mesh.volume

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

