Centroid Calculator

Centroid Calculator

Calculate the centroid (geometric center) of triangles, polygons, or point clouds. Essential for engineering, physics, and computer graphics.

Last updated: April 2026 | By Patchworkr Team

Vertex 1

Vertex 2

Vertex 3

Results will appear here...

Centroid Formulas

Triangle:
C = ((x₁+x₂+x₃)/3, (y₁+y₂+y₃)/3)
Average of the three vertices
Polygon (Shoelace Method):
Cx = Σ(xᵢ+xᵢ₊₁)(xᵢyᵢ₊₁-xᵢ₊₁yᵢ) / (6A)
Cy = Σ(yᵢ+yᵢ₊₁)(xᵢyᵢ₊₁-xᵢ₊₁yᵢ) / (6A)

What is a Centroid?

The centroid is the geometric center or "center of mass" of a shape, assuming uniform density. It's the point where the shape would balance perfectly if made of a uniform material.

Key properties:

  • Triangle: Intersection of medians; located at 2/3 the distance from each vertex to the opposite midpoint
  • Polygon: Calculated using the shoelace formula, weighted by area distribution
  • Point cloud: Simple average of all point coordinates
  • Unique: Every closed shape has exactly one centroid

How to Calculate Centroids

Step 1: Determine Your Shape Type

Identify whether your shape is a triangle, polygon, or point cloud. Why: Different shapes use different mathematical approaches. Triangles have a simple averaging formula, polygons require area-weighted calculation (shoelace formula), and point clouds use simple coordinate averaging.

Step 2: Gather Your Vertex or Point Data

For triangles: collect (x₁,y₁), (x₂,y₂), and (x₃,y₃). For polygons: list all vertices in order (clockwise or counter-clockwise). For point clouds: collect all point coordinates. Why: Accurate input ensures accurate output. Polygon order matters for the shoelace formula (wrong order reverses the area sign but magnitude stays the same).

Step 3: Apply the Appropriate Centroid Formula

Triangle: Cx = (x₁+x₂+x₃)/3, Cy = (y₁+y₂+y₃)/3
Polygon: Cx = Σ(xᵢ+xᵢ₊₁)(xᵢyᵢ₊₁-xᵢ₊₁yᵢ)/(6A), Cy = Σ(yᵢ+yᵢ₊₁)(xᵢyᵢ₊₁-xᵢ₊₁yᵢ)/(6A)
Point Cloud: Cx = ΣX/n, Cy = ΣY/n

Why: Each formula corresponds to the shape's geometry. The triangle formula's simplicity reflects triangles' symmetry. The polygon formula's complexity ensures it accounts for non-uniform area distribution. Point cloud averaging is basic because order is irrelevant.

Step 4: Calculate Area (if applicable)

For triangles and polygons, calculate area using the shoelace formula: A = ½|Σ(xᵢyᵢ₊₁ - xᵢ₊₁yᵢ)|. Why: Area is needed for polygon centroid calculation (it's the normalizing factor in the denominator). It also validates your input—zero area means degenerate (collinear) points that don't form a proper shape.

Step 5: Verify and Apply

Check that the computed centroid lies within (or very near) your shape. For triangles, it should always be inside. For polygons, it may be outside if the shape is concave. Verify units and precision. Why: This sanity check catches calculation errors. Understanding where the centroid should be helps you spot mistakes immediately, and confirming units ensures correct application to real-world problems (e.g., structural loading calculations).

Real-World Example

Structural Engineering - Beam Center of Mass

Given:
A triangular support bracket has vertices at (0,0), (6,0), and (3,4). Where is its center of mass?
Calculate:
Cx = (0+6+3)/3 = 3
Cy = (0+0+4)/3 ≈ 1.33
Result:
Center of mass at (3.0, 1.33)

Frequently Asked Questions

What is the centroid formula for a triangle?

Average the three vertices: Cx = (x₁+x₂+x₃)/3 and Cy = (y₁+y₂+y₃)/3. This point is where the three medians intersect.

Is centroid the same as center of mass?

For shapes with uniform density, yes. For non-uniform density or 3D objects, the center of mass may differ from the geometric centroid.

Where is the centroid of a triangle located?

At the intersection of the three medians, 2/3 of the way from each vertex to the opposite side's midpoint.

Can the centroid be outside the shape?

Yes, for concave shapes. A crescent moon or L-shape can have a centroid in the empty space.

How do I find the centroid of complex shapes?

Break the shape into simpler pieces (triangles, rectangles), find each centroid, then compute the weighted average based on areas.

What's the difference between centroid and center?

Centroid is the center of mass/area. 'Center' can mean different things: geometric center (average of bounds), circumcenter (equidistant from vertices), or incenter (center of inscribed circle).

Why use the shoelace formula for polygons?

It accounts for how area is distributed. Simple averaging of vertices only works for triangles; polygons need area-weighted calculation.

Can I use this for 3D shapes?

The formulas here are for 2D. For 3D, extend to volume integrals or decompose into simpler 3D shapes (tetrahedra, cubes).

Related Tools