How this calculator works
For a triangle the centroid is simply the average of the three vertex coordinates, which is also where the three medians meet. For a set of separate points the centroid is the average position of those points. A polygon is different: vertices are not evenly spaced around the shape, so the calculator weights each vertex by the signed area it contributes. It uses the shoelace formula to find the polygon area and the standard weighted sums for the centroid. A polygon whose vertices enclose zero area has no centroid and is rejected.
Formula
Triangle: G = ((x₁ + x₂ + x₃)/3, (y₁ + y₂ + y₃)/3). Polygon: Gx = Σ(xᵢ + xᵢ₊₁)(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ) / (3Σ(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ)), with the same pattern for Gy. Points: the mean of the coordinates.
Worked example
A triangle with vertices (0, 0), (6, 0) and (0, 6) has centroid (2, 2). The square with vertices (0, 0), (6, 0), (6, 6) and (0, 6) has centroid (3, 3) and area 36 square units.
Advertisement
Frequently asked questions
Does vertex order matter for a polygon?
The vertices must be listed in order around the outline, either clockwise or anticlockwise. Crossing the outline or shuffling the order can describe a self-intersecting shape and give a meaningless centroid.
Why is the polygon centroid not the average of the vertices?
The average of the vertices depends on how many vertices happen to lie on each side. The centroid weights each triangle formed with the origin by its area, so it describes the shape itself rather than its list of corners.
What units does the answer use?
Coordinates are plain numbers in whatever consistent unit you measured with. The centroid is in the same unit, and the polygon area is in that unit squared.
Can points be repeated?
Yes for the points mode, because repeated points simply carry extra weight in the average. A polygon with repeated adjacent vertices still works as long as the remaining vertices enclose a nonzero area.