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!


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+