# Calculate the centroid of a simplex surface?

**URL:** https://discourse.itk.org/t/calculate-the-centroid-of-a-simplex-surface/2096
**Category:** Uncategorized
**Created:** [July 26, 2019, 5:28pm UTC](https://discourse.itk.org/t/calculate-the-centroid-of-a-simplex-surface/2096 "2019-07-26T17:28:33Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [July 26, 2019, 8:36pm UTC](https://discourse.itk.org/t/calculate-the-centroid-of-a-simplex-surface/2096/2 "2019-07-26T20:36:25Z")

</div>

For a closed volume part, one way to do it is to:

1. pick a random point as guessed center
2. calculate volume of each tetrahedron formed by the point and the triangles of the part
3. keep a sum of the multiples of small tetrahedons’ volume and center
4. divide the sum by the total volume

Here is an [example code](https://github.com/dzenanz/SpineSource/blob/334d6893422f5c80277725c8d5c2938d8698111e/SpineAI/vertebra.cpp#L478-L504).

---

_[View the full topic](https://discourse.itk.org/t/calculate-the-centroid-of-a-simplex-surface/2096)._
