# How to find the barycentre of a convex polyhedron?

Suppose that I have a closed and convex polyhedron given by the following vertices:

$(0.5, 0.5, 0), (0.25, 0.5, 0.25), (0.75, 0, 0.25), (0.75, 0.25, 0)$

Unless I'm wrong, the barycentre (which is the geometrical centroid) shall be computed by averaging the the vertices, which in this case yields the following vector:

$c=(9/16,5/16,1/8)$

I'm running this simple line on Mathematica:

RegionCentroid[Polygon[{{0.5, 0.5, 0}, {0.25, 0.5, 0.25}, {0.75, 0, 0.25}, {0.75, 0.25, 0}}]]


Which delivers the following vector as the region centroid:

$c^\prime = (0.555556,0.305556,0.138889)$

Of course, $c \neq c^\prime$. Can anybody please tell me what I am missing here? Why is it the case that $c=c^\prime$? I assume that, since I'm new in Mathematica, I'm using RegionCentroid incorrectly, but I can't see how.

• I don't think it's the average of the vertices. Minor quibble: RegionCentroid[ConvexHullMesh[points]] will work when the points form a polyhedron. Your points seem to be coplanar, so they form a polygon. Commented Jan 17, 2018 at 17:49
• @MichaelE2 Okai, I got the definition wrong in the first place! By the way, if my points form a closed and convex polytope in $\mathbb{R}^N$, can I still find the centroid with some other function or something? Commented Jan 18, 2018 at 11:29
• I don't know a way. I don't think there's a built-in way to find the convex hull or triangulation in dimensions > 3. There's MATLAB function someone wrote, if you have access to MATLAB. Commented Jan 18, 2018 at 14:07
• Thank you very much for your comment. I have had access to Matlab in the past, but not anymore. I'm going to ask on this site if anyone knows a way to do what that function does in Matlab but in Mathematica instead. Commented Jan 18, 2018 at 14:20

Under details and options of RegionCentroid documentation:

The centroid is effectively given by Integrate[{x1, x2, ...}, {x1, x2, ...} in reg]/RegionMeasure[reg]

For example,

p = Polygon[{{0.5, 0.5, 0}, {0.25, 0.5, 0.25}, {0.75, 0, 0.25}, {0.75,0.25, 0}}];
Integrate[{x, y, z}, {x, y, z} ∈ p]/RegionMeasure[p]


{0.555556, 0.305556, 0.138889}

• Perfect, thank you very much! Commented Jan 17, 2018 at 18:11