center_of_mass

ExplicitStructuredGrid.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.

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.])