Jump to content
  • Advertisement
Sign in to follow this  
Dirk Gregorius

Centre of Polyhedra

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Quote:
Original post by DonDickieD
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


The above will work provided w is in the local frame. If you already have the momentum and velocity handy (in world space):


flt getTotalKineticEnergyRB(RigidBody & rb) {
flt linE = rb.linM.dot(rb.linVel);
flt rotE = rb.rotM.dot(rb.rotVel);
return .5f*(linE + rotE);
} // getTotalKineticEnergyRB


Share this post


Link to post
Share on other sites
Advertisement
Some definitions:

(i) MOMENTS: Nth degree moment generating function of an arbitrary distribution D(X) of i samples x1,x2...x(i), around point c, is defined as: SUM(i=1,...,m)[D(x(i))*(x(i)-c)^n]
If the distribution is continuous, the formula turns into
Intergral[of x][D(x)*(x-c)^n][dx]

(ii) CENTROID: Centroid of a volume is the origin of coordinate axes for which first moments of the volume are zero. It is considered center of a volume. For a homogeneous body in a parallel gravity field, mass center and center of gravity coincide with the centroid.

(iii) FIRST MOMENT OF A FINITE DISTRIBUTION D(X(i)) AROUND POINT 'c':
SUM(i=1,...,m)[D(X(i))*(X(i)-c)]

(iv) THUS FOR C TO BE THE CENTROID OF VOLUME:
SUM(i=1,...,m)[D(X(i))*(X(i)-c)] = 0 <=>
D(x1)*(x1-c) + D(x2)*(x2-c) + ... + D(x(i))*(x(i)-c) = 0 <=>
(X1-C) + (X2-C) + ... + (X(i)-C) = 0 <=>
X1+X2+...+Xi = i*c <=>
C = (X1+X2+...+X(i))/i (points' average!)

where D(Xk)=D(Xj) for all k,j in 1,...,i since the body is homogenous


Quote:

@someusername
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.(my comments: For a homogeneous body in a parallel gravity field, mass center and center of gravity coincide with the centroid of volume) You only consider 4 vertices from a solid body - what would be wrong...


You don't want to find the volume; you want the centroid. Even if you manage to define a valid continuous distribution of mass for this volume and solve the integral it would give you the very same result, because:
the convex closure of those 8 points in R^3 is not missing any of the volume if you found a symbolic parametrization for it. Nor is it adding any.
[ edit: I'm missing something here! The original 4vertices polygon needs to be convex for this to hold. ]
(And I din't imply 4 vertices, I implied all 8.)



I am trying to make my point through math here. If my math is wrong then my point is wrong!
This is the last post from me on this subject

[Edited by - someusername on December 1, 2005 12:03:17 PM]

Share this post


Link to post
Share on other sites
@someusername
Thanks for your help so far. Actually I made the same assumption as you did, but became a little supicious through the behaviour of my simulator. So I tried to verify the formula by an example:

v1 = (1,1), v2 = (3,1), v3 = (1,2), v4 = (3,3)

These four points define a trapez. If you now build the centroid using you formula:

c = 0.25 * (v1 + v2 + v3 + v4) = 0.25 * (8, 7)

This isn't the centroid of the trapez. You can verify this by simply drawing the shape defined be the four points. You will find a rectangle and a triangle. The centroid of the trapez will lie on the line between the centroid of the triangle and the rectangle. The above point doesn't. Actually the x-coordinate can't be 2.

HTH,

-Dirk

PS:
Maybe you need to make a difference. I am not looking for the centroid of the point cloud, but I am looking for the centroid of the polyhedra defined by these points.

Share this post


Link to post
Share on other sites
Quote:

c = 0.25 * (v1 + v2 + v3 + v4) = 0.25 * (8, 7)

This isn't the centroid of the trapez. You can verify this by simply drawing the shape defined be the four points. You will find a rectangle and a triangle. The centroid of the trapez will lie on the line between the centroid of the triangle and the rectangle. The above point doesn't. Actually the x-coordinate can't be 2.

?
You're totally wrong. A trapezoid is a special case of quadrilaterals for which the following theorems hold.

1) theorem #1
The centroid of a quadrilateral occurs at the point of intersection of its bimedians. (the segments connecting pairs of opposite midpoints)

In your case one of the bimedians is the segment connecting the point M13(1,1.5) (Midpoint of segment connecting vertices 1 & 3) and M24(3,2) (the midpoint of the segment connecting the vertices 2 & 4)
The other is the segment connecting M12(2,1) M34(2,2.5)
They obviously intersect at (2,1.75) == .25*(8,7)

2) Theorem #2
The centroid of a quadrilateral occurs at the midpoint of the segment that connects the midpoints of its diagonals.

In your case midpoint of diagonal D14 is (2,2) and that of D32 is (2,1.5)
The midpoint of D14 - D32 is again (2, 1.75) == .25*(8,7)

I don't know what you're trying to calculate here, but it's NOT the centroid!

[edit: typo]

Share this post


Link to post
Share on other sites
The centroid is (only x_coordinate):

xs = ( xs1 * A1 + xs2 * A2 ) / A_total

A1 = 2 (Area of the lower rectangle)
A2 = 1 (Area of the upper triangle)

xs1 = 2 (x-coordinate of the centroid of the lower rectangle)
xs2 = 7/3 (x-coordinate of the centroid of the upper triangle)

xs = (2 * 2 + 7/3 * 1) / 3 = (12/3 + 7/3) / 3 = 19 / 9 = 2.1111 != 2

Maybe you are right. English is not my native language and what I actually calculate here is the center of gravity. Sorry if this was wrong!

Regards,

-Dirk

PS:

"A trapezoid is a special case of quadrilaterals for which the following theorems hold."

Are you sure this is correct? I would be careful to use theorems of quadrilaterals for trapezoids. The center of gravity of a shape composed of two simple shapes, must lie on the connection line between the centers of the two simple shapes. Forget all this math stuff and theorems for a moment and try to balance the trapezoid on your finger. I am sure that you agree that you can't balance it if you put you finger at xs = 2

Share this post


Link to post
Share on other sites
OK, I'm forgeting the math and the equations and the theorems...
Indeed centroid's X == 2 seems weird, because x=2 is in the middle and there is definitely more "area" to the right side of the trapezium.

BUT THE CENTROID'S Y ISN'T IN THE MIDDLE TOO!!! IT'S NOT 2!!! ITS 1.75 WITCH IS LOWER THAN MIDDLE, WHERE THERE IS ALSO MORE AREA!

How else can I put it?

And why not use theorems of quadrilaterals on trapezia? They're just quadrilaterals with 2 parallel sides.

[Edited by - someusername on December 1, 2005 6:07:58 PM]

Share this post


Link to post
Share on other sites
At DonDickieD
I want to apologize for the tone of my previous reply. It was an act of impulse, honestly, I didn't think this through. I'm sorry I came off as a dick... Honestly.

And of course you're obviously right about the specific counter-example.

If you're still interested in any more input on this, from me, I'll do my best to be of any assistance.

Share this post


Link to post
Share on other sites
First: No problem - I didn't understand it like this!

As I mentioned in an earlier post I made exactly the same assumption like you, namely that the centroid is simply the average of the vertices and used your formula. Than I got skeptic beacuse of the result in my application and setup the small example and tried to verify if the result holds for this specific example. As we both know know - it didn't.

The first thing that I believe is wrong is that we are merging two different things. I think the formula is right, but can't be used here. While the average is of course the center of a point cloud, it isn't necessarily the center of the surface/volume defined by the points. The formula for the center of gravity is:

xs = Sum( xs_i * A_i ) / A_total

This is a weighted average. Of course for a point cloud there is no such thing as an area and the formula simply becomes the arithmetic mean.

Regarding your theorem #1 from a previous post:

I am not sure here since I am not sure if what you mean by "BiMedian" is the same as I think it is. So again a little example:

The centroid of a triangle is the intersection of the perpendicular lines in the middle of each edge. Ii it that what you mean by BiMedian? If yes, then think how this line will look like for the edge (1,2) to (3,3). So you see a reason why I think that you can't carry out the formula of the rectangle to the trapez.

Dirk

Share this post


Link to post
Share on other sites
ok, I just wanted to let you know I regret, that's all.

The formula you are presenting for the centroid's x-coord seems to be fine, since when viewed as vector equation for the centroid's coordinates, it merely states that for any two objects their centroid is on the line connecting their own centroids at a distance depending on their ares over their total sum. And it generalizes for 'n' objects. This makes perfect sense.

The two theorems I posted above are correct. (for that I'm sure... You can check the site I linked in a previous reply) And there is also another one -as far as I remember- especially for trapezoids, stating that its centroid lies on the bimedian (more on that below) which is parallel to its 2 parallel edges, also providing a formula (which eludes me right now) to calculate the other coordinate too, based entirely on the edges length and its height.

Your counter-example though, got me thinking to be honest. Maybe some quadrilaterals' theormes don't hold true for trapezoids? But how can that be? I mean, they apply to the square and rhombus which are even more special/constrained categories of quadrilaterals.

As for the bimedian (of a quadrilateral), I understand it is the segment that connects the midpoints of two non-adjacent edges. I.e. in a trapezoid, the bimedian of its two non-parallel edges, is parallel to its other two edges.

Quote:

The centroid of a triangle is the intersection of the perpendicular lines in the middle of each edge. Ii it that what you mean by BiMedian?

No not all. Bimedian isn't even defined for 3-gons

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!