_PointSetBase.center_of_mass

_PointSetBase.center_of_mass#

_PointSetBase.center_of_mass(scalars_weight: bool = False) NumpyArray[float][source]#

Return the coordinates for the center of mass of the mesh.

Parameters:
scalars_weightbool, default: False

Flag for using the mesh scalars as weights.

Returns:
numpy.ndarray

Coordinates for the center of mass.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> mesh = pv.Sphere(center=(1, 1, 1))
>>> mesh.center_of_mass()
array([1., 1., 1.])