[Solved] Center of mass of an arbitrary 2D object
Posted: Tue May 11, 2010 2:11 pm
So I have a list of 2D points forming an arbitrary object. What I want to do now is to calculate
the center of mass of this object. Is there a general algorithm for it?
I guess what needs to be done is to let every perpendicular intersect, but I'm not sure...
EDIT:
OK, I found these equations on Wikipedia:



Where A is the surface of the polygon, and Cx & Cy are the coordinates of the centre of mass.
Is this the correct way?
EDIT2:
I found yet another, simpler, way:

Where n is the number of points I have...
the center of mass of this object. Is there a general algorithm for it?
Code: Select all
Structure Vector2D
x.f
y.f
EndStructure
Global NewList Edges.Vector2D() ; e.g. (2; 3), (3; 5), (4; 3)
Procedure CenterOfMass(*Result.Vector2D)
;...
EndProcedure
EDIT:
OK, I found these equations on Wikipedia:



Where A is the surface of the polygon, and Cx & Cy are the coordinates of the centre of mass.
Is this the correct way?
EDIT2:
I found yet another, simpler, way:

Where n is the number of points I have...