# calculate the center of mass incorrectly after clipping polydata

**URL:** <https://discourse.vtk.org/t/calculate-the-center-of-mass-incorrectly-after-clipping-polydata/1691>\
**Category:** Development\
**Created:** [September 4, 2019, 11:14am UTC](https://discourse.vtk.org/t/calculate-the-center-of-mass-incorrectly-after-clipping-polydata/1691 "2019-09-04T11:14:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthijs\_Hendriks](https://discourse.vtk.org/user_avatar/discourse.vtk.org/matthijs_hendriks/32/845_2.png) [@Matthijs\_Hendriks](https://discourse.vtk.org/u/Matthijs_Hendriks)\
**Post date:** [September 4, 2019, 11:14am UTC](https://discourse.vtk.org/t/calculate-the-center-of-mass-incorrectly-after-clipping-polydata/1691/1 "2019-09-04T11:14:24Z")

</div>

The center of mass is calculate not correctly after clipping a polydata.  
I get the center of mass of the original polydata

---

<div class="post-metadata">

**Author:** ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)\
**Post date:** [September 4, 2019, 1:39pm UTC](https://discourse.vtk.org/t/calculate-the-center-of-mass-incorrectly-after-clipping-polydata/1691/2 "2019-09-04T13:39:40Z")

</div>

If you compute center of mass from all the points in the polydata then make sure you delete all the points that are not used in any cells are removed. For example, you can use [vtkCleanPolyData](https://vtk.org/doc/nightly/html/classvtkCleanPolyData.html) filter to remove all unused points.

---

<div class="post-metadata">

**Author:** ![Matthijs\_Hendriks](https://discourse.vtk.org/user_avatar/discourse.vtk.org/matthijs_hendriks/32/845_2.png) [@Matthijs\_Hendriks](https://discourse.vtk.org/u/Matthijs_Hendriks)\
**Post date:** [September 4, 2019, 2:09pm UTC](https://discourse.vtk.org/t/calculate-the-center-of-mass-incorrectly-after-clipping-polydata/1691/3 "2019-09-04T14:09:00Z")

</div>

Yess thanks, this solved the problem
