# Centre of Polyhedra

This topic is 4859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Is there a general formula to compute the centre of a polyhedra? I am looking for the centre of the polyhedra that is build by the contact polygon of two rigid bodies and the relative velocities at each contact point. E.g. Given four vertices that define a planar polygon and lie in the plane with the normal n. Each of the vertices has a relative velocity in the direction of the normal. How do I compute the centre of the polyeder with the vertices of the planar polygon and four additional points which are computed this way: x_i + vn_i * n x_i: The coordinate of vertex i (vector) vn_i: The relative normal velocity of vertex i (scalar) n: The normal of the planar contact polygon Currently I simply build a weighted sum: x_avg = Sum( vn_i * x_i ) / Sum( vn_i ) In short: I am looking for the centroid of the volume defined by the planar contact polygon and the associated relative normal velocities at each of the polygons vertices. Regards, -Dirk

##### Share on other sites
I think the center of mass should be a simple average of the vertexes if it's convex. if it's not convex you could compute surface integrals. I'm not sure on the conditions of the center of mass being a weighed average of the verticies. I'm thinking if it's a convex polyhedron then this holds, does anyone know? you could always use a surface integral across the polys of your shape. Use Divergence theorem to transform the center of mass problem from a volume integral to a sruface integral.

##### Share on other sites
You can find the centroid of a nonconvex polyhedra by computing a volume weighted average of the tetrahedron centroids formed between each triangle face and a single arbitrary point. Checkout mathworld for the volume formula for tetrahedra.

Algorithm:
pick a point p (perhaps the origin)c = (0,0,0)v = 0for each triangular face i  get verts v1, v2, v3  ci = 0.25 * (p + v1 + v2 + v3)  vi = volume of tetrahedron(p,v1,v2,v3)  v += vi  c += vi * ciendc /= v

##### Share on other sites
I kinda thought that the centroid for geometric objects is the center of mass...
Am I wrong?

If not, you can use can use the classic vector formula for the barycenter (center of mass):
v = (1/n)*(v(1) + *v(2) + ... + v(n)), where v(i) is the vector to the vertex #i

(Am I misinterpreting sth here?)

##### Share on other sites
Consider a triangle (v1,v2,v3). The center is equal to the average of the vertices. Now add a fourth vertex v4 very close to v1. Now average the vertices. The average will now be closer to v1. Now add about a bunch more vertices close to v1. Now the average will be right next to v1. However, the overall shape is just like the original triangle and the centroid has barely moved.

average != centroid

##### Share on other sites
My question was whether centroid and center of mass is the same thing. If they are, then this means that centroid and barycenter (center-of-weight in greek) are essentially the same thing, therefore the very same formula for the barycenter would apply to the centroid as well.

Given a finite convex set C={v1,v2,...,v(N)} of points in M-dimensional space, (M>=N), each point of the subset A in R^M whose cover is C, can be expressed in a unique way as a linear combination of those points in barycentric coordinates, written as:

v = a1*v1 + a2*v2 + ... + a(n)*v(n)

where a(i) are all positive real numbers in the range {0...1} and their sum is equal to 1. (The point's barycentric coordinates)
The special point with the property a(i) = 1/n, is called "the barycenter of set A" with respect to the cover C.

Quote:
 Now add about a bunch more vertices close to v1. Now the average will be right next to v1. However, the overall shape is just like the original triangle and the centroid has barely moved.

Barely moved? The new center of mass would be *definitely* biased to v1. Unless you're assigning infitesimal weights to those new vertices, I can only assume that you didn't even try this in paper!

[ edit: if, - I repeat-, centroid and center of mass are the same thing. ]

##### Share on other sites
The following is from :
http://mathworld.wolfram.com/GeometricCentroid.html

[...] The coordinates of the centroid (also called the center of gravity) [...]

[...]
The centroid of a set of n point masses m(i) located at positions x(i) is
x = SUM(i=1,...,n)[m(i)*x(i)] / SUM(i=1,...,n)[m(i)]

which, if all masses are equal, simplifies to
x = SUM(i=1,...n)[x(i)]/n.
[...]

##### Share on other sites
But we aren't talking about point masses. If it is just a bunch of point masses then there is no need to talk about polygons or polyhedra. The centroid of a polygon is the center of area. The centroid of a polyhedra is the center of volume. These are both the center of mass if the density is isotropic.

In my example above I add a bunch of points to a polygon that do not change it's shape. Therefore, it's center of area does not move. However, the average of the vertices does move.

My algorithm involving tetrahedrons is a weighted sum. And the weights sum to unity. So you can view the weights as Barycentric coordinates, but that does not tell you how to compute them.

##### Share on other sites
CENTER. That is all. [grin]

##### Share on other sites
Hey Erin,

thanks for the reply. This was the kind of formula I was looking for. I have very bad days finding the formulas I need at the moment :-) E.g.
What is the rotational energy of a rigid body. I remember that it is:

T = 0.5 * I * w^2

For the cases of a 3D rigid bodies w is a vector so could I calculate it like this?

T = 0.5 * (I * w) * w

Currently I use a formula that work in body space w.r.t. the principal axes, since I am not sure if the matrix- vector multiplication binds stronger than the dot product?

I am looking for the center of the volume. If you consider this volume as the infently points masses, the integral over all these point masses will give you the center of gravity. You only consider 4 vertices from a solid body - what would be wrong...

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 24
• 15
• 36
• 12
• ### Forum Statistics

• Total Topics
634823
• Total Posts
3019459
×