Sign in to follow this  
FreeDebreuil

Center of mass

Recommended Posts

Does anyone know an easy way to find the center of mass for a 2d polygon? I thought maybe finding the average of the points, but weighting the points for how far apart the lines are... Thanks!

Share this post


Link to post
Share on other sites
If you need to calculate the centroid of flat polygon, one sipmle way is to

1) first triangulate it
2) then, each triangle has it's area (evaluated simply by half modulo of sideds vector product) and it's mass center (point of medians intersection)
3) now, we treat everu triangle in triangulation as point in triangle mass center with mass of triangle area
4) then simply find the weighted average of this points, as mentioned in link above

GL!

Share this post


Link to post
Share on other sites
for triangles and quads, take the average of each of it's vertices, this will give you the gemoetric center, which is the center of mass provided the density is constant, if it's not constant you would have to anlitically integrate it, you could

a) IF your surface is easily paramterizable
use numarical integration
b) If your surface is NOT easily paramaterizable,
use monte carlo integration

both of these methods are definitly off line approaches.

monte carlo integration with stratified sampling would be a more efficent approach then Jackis method as it would not require triangulation his method as far as I can see, which would still require integration of the subdomains(triangles) to be correct.

Tim

[Edited by - timw on September 7, 2005 11:58:47 PM]

Share this post


Link to post
Share on other sites
No, my method doesn't require integration of subdomains, cause subdomains are simple triangles, so, it only represents subdomains as weighted points, evaluated simply, center of mass remains the same.
Triangulation is needed, yes, but Monte-Carlo method has some lacks, like it is numerical and not exact, and it must check each new point for intersection with polygon (it takes O(n), where n is the number of polygon edges in general case, sure, it may be optimized). Triangulation costs N*logN (ear triangluation), and it is done once per polygon.

Sorry, may be, I didn't understand you right, because of translation difficulties )))

Share this post


Link to post
Share on other sites
I was talking about the case of non constant density, which I think you weren't sorry. if the density is non constant, triangluation wont work, but looking back it looks like you were only talking about uniform density case, sorry.

Tim

Share this post


Link to post
Share on other sites
timw

You're absolutely right, my proposed method will solve the problem only in a case of uniform density.
When it becomes varying, the thing you proposed will be the most comfortable way to solve the problem.

Thanks for this little fix! I forgot to mention density uniformness.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this