center_of_mass#
- UnstructuredGrid.center_of_mass(scalars_weight=False)#
Return the coordinates for the center of mass of the mesh.
- Parameters
- scalars_weightbool,
optional
Flag for using the mesh scalars as weights. Defaults to
False
.
- scalars_weightbool,
- Returns
numpy.ndarray
Coordinates for the center of mass.
Examples
>>> import pyvista >>> mesh = pyvista.Sphere(center=(1, 1, 1)) >>> mesh.center_of_mass() array([1., 1., 1.])