WOLFRAM NOTEBOOK

Center of Mass of a Polygon

crosshairs
none
The result is not valid for self-intersecting polygons!
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:
{X,Y}={
M
x
,
M
y
}A
. Move or add new locators and watch the center of mass move. Careful: if the polygon boundary intersects itself, the results are invalid!

Details

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
A=
1
2
n
i=1
(
x
i
y
i+1
-
x
i+1
y
i
)
or
1
2
n
i=1
(
x
i
+
x
i+1
)(
y
i+1
-
y
i
)
and the first moment about the
x
axis is
M
x
=
1
6
n
i=1
2
x
i
+
x
i
x
i+1
+
2
x
i+1
(
y
i+1
-
y
i
)
or
1
6
n
i=1
(
x
i
+
x
i+1
)(
x
i
y
i+1
-
x
i+1
y
i
)
, where the vertices
{
x
i
,
y
i
}
are listed in counterclockwise order around the polygon and
(
x
n+1
,
y
n+1
)=(
x
1
,
y
1
)
.
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
(x>0,y>0)
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
x
and
y
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

References

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.

External Links

Permanent Citation

Kenneth E. Caviness, Bruce Atwood, Stan Wagon

​"Center of Mass of a Polygon"​
http://demonstrations.wolfram.com/CenterOfMassOfAPolygon/
Wolfram Demonstrations Project
​Published: January 12, 2010
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.