Center of Mass of a Polygon
Both the area and the various moments of a simple polygon can be written as simple functions of the coordinates of the vertices. These formulas can then be used to identify the center of mass of the polygon: . Move or add new locators and watch the center of mass move. Careful: if the polygon boundary intersects itself, the results are invalid!
The formulas for the area and the first and second moments of a simple polygon (i.e., without holes or boundary intersections, but not necessarily convex) can be elegantly derived using Green's theorem, or can be built from first principles.
For example, the area is or and the first moment about the axis is or , where the vertices are listed in counterclockwise order around the polygon and .
For the calculations, the polygon is assumed to be cut from a thin sheet of some material of uniform density. For simplicity, the vertex positions are limited to the first quadrant and we use the absolute values of the formulas, meaning that the position of the center of mass will be correctly determined whether or not the vertices are ordered counterclockwise. You can freely add or delete vertices, but be sure that the boundary does not intersect itself. (If it does, the overlapping region is effectively a negative mass!)
The "crosshairs" options show dotted lines through the center of mass, either parallel to the and axes (allowing easy visualization of the center of mass coordinates) or with additional diagonal lines, highlighting the idea that the polygon can balance on any knife edge that passes under the center of mass.
Thumbnail: if the polygon is not convex, the center of mass may lie outside the area of the polygon: here on the line between the two arms
Snapshot 1: the center of mass of a triangular plate lies exactly 1/3 of the way from the base towards the opposite vertex—no matter which side is called the base
Snapshot 2: the center of mass of the map of Austria
Snapshot 3: a self-intersecting polygon, where the calculation of the center of mass basically treats one part of the area as having negative mass, effectively repelling the center of mass from its expected position
S. F. Bockman, "Generalizing the Formula for Areas of Polygons to Moments," American Mathematical Monthly, 96(2), 1989 pp. 131–132.
P. Bourke, Calculating the Area and Centroid of a Polygon, 1988.
S. Wagon, Mathematica in Action, 2nd ed., New York: Springer, 1999.