RegionCentroid[reg]
gives the centroid of the region reg.
RegionCentroid
RegionCentroid[reg]
gives the centroid of the region reg.
Details and Options
- RegionCentroid is also known as center of mass, center of gravity, or barycenter.
- The centroid is effectively given by Integrate[{x1,…,xn},{x1,…,xn}∈reg]/RegionMeasure[reg].
- The centroid is in the region when the region is convex. Otherwise it is typically not in the region.
- Examples of cases where rows correspond to embedding dimension and columns to geometric dimension:
- If the region reg consists of a finite number of points, the RegionCentroid gives the mean.
- A region with infinite RegionMeasure has no RegionCentroid and returns a point with Indeterminate coordinates.
- RegionCentroid takes an Assumptions option that can be used to specify assumptions on parameters.
- RegionCentroid can be used with symbolic regions in GeometricScene.
Examples
open all close allBasic Examples (2)
Find the centroid of a region:
RegionCentroid[Disk[{x, y}, r]]RegionCentroid[Rectangle[{a, b}, {c, d}]]The centroid of a Polygon:
ℛ = Polygon[{{0, 0}, {1, 0}, {1.5, 0.5}, {1, 1}, {0, 1}, {-0.5, 0.5}}];RegionCentroid[ℛ]Graphics[{LightBlue, ℛ, Red, Point[RegionCentroid[ℛ]]}]Scope (25)
Special Regions (10)
The centroid for Point corresponds to the mean of the coordinates:
ℛ = Point[Tuples[Range[5], 2]];
Region[ℛ]RegionCentroid[ℛ]Points can be used in any number of dimensions:
RegionCentroid[Point[Tuples[Range[5], 4]]]Line:
ℛ = Line[{{0, 0}, {1, 1}, {1, 0}}];
Graphics[{ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Lines can be used in any number of dimensions:
RegionCentroid[Line[{{0}, {1}}]]RegionCentroid[Line[{{0, 0, 0}, {1, 1, 1}}]]Rectangle can be used in 2D:
RegionCentroid[Rectangle[{Subscript[l, x], Subscript[l, y]}, {Subscript[u, x], Subscript[u, y]}]]ℛ = Rectangle[{0, 1}, {3, 3}];
Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Cuboid can be used in any number of dimensions:
RegionCentroid[Cuboid[{Subscript[l, x], Subscript[l, y], Subscript[l, z]}, {Subscript[u, x], Subscript[u, y], Subscript[u, z]}]]ℛ = Cuboid[{1, 2, 3}, {5, 5, 5}];
Graphics3D[{{Opacity[0.5], ℛ}, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]A 4D Cuboid:
RegionCentroid[Cuboid[{Subscript[l, x], Subscript[l, y], Subscript[l, z], Subscript[l, w]}, {Subscript[u, x], Subscript[u, y], Subscript[u, z], Subscript[u, w]}]]A Simplex can correspond to a point, line, or triangle in 2D:
ℛ = {Simplex[{{0, 0}}], Simplex[{{0, 0}, {1, 1}}], Simplex[{{0, 0}, {1, 0}, {0, 1}}]};Table[Framed@Graphics[{Lighter[Blue, 0.5], s, Red, Point[RegionCentroid[s]]}, ImageSize -> 50], {s, ℛ}]RegionCentroid /@ ℛSimplices can be used in any number of dimensions:
RegionCentroid[Simplex[{{0}, {1}}]]RegionCentroid[Simplex[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]]The centroid of a standard unit Simplex in dimension
:
Table[RegionCentroid[Simplex[n]], {n, 1, 5}]The centroid of a Polygon may lie outside the region:
ℛ = Polygon[{{0, 0}, {3, -1}, {1, 0}, {3, 1}}];
Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]ℛ = Polygon[{{0, 0, 0}, {(5/3), (2/3), -(4/3)}, {(8/15), (8/15), -(4/15)}, {1, 2, 0}}];
Graphics3D[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Disk can be used in 2D:
RegionCentroid[Disk[{Subscript[c, x], Subscript[c, y]}, r]]ℛ = Disk[{2, 3}, 2];
Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Ball can be used in any dimension:
RegionCentroid[Ball[{Subscript[c, x], Subscript[c, y], Subscript[c, z]}, r]]ℛ = Ball[{1, 2, 3}, 4];
Graphics3D[{{Opacity[0.5], ℛ}, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]RegionCentroid[Ball[{Subscript[c, x], Subscript[c, y], Subscript[c, z], Subscript[c, w]}, r]]Disk as an ellipse can be used in 2D:
RegionCentroid[Disk[{Subscript[c, x], Subscript[c, y]}, {Subscript[r, x], Subscript[r, y]}]]ℛ = Disk[{0, 0}, {3, 2}];
Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Ellipsoid can be used in any dimension:
RegionCentroid[Ellipsoid[{Subscript[c, x], Subscript[c, y], Subscript[c, z], Subscript[c, w]}, {Subscript[r, x], Subscript[r, y], Subscript[r, z], Subscript[r, w]}]]ℛ = Ellipsoid[{0, 0, 0}, {3, 2, 1}];
Graphics3D[{{Opacity[0.5], ℛ}, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Circle can be used in 2D:
RegionCentroid[Circle[{Subscript[c, x], Subscript[c, y]}, r]]ℛ = Circle[{0, 0}, 1];
Graphics[{ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]RegionCentroid[Circle[{Subscript[c, x], Subscript[c, y]}, {Subscript[r, x], Subscript[r, y]}]]ℛ = Circle[{0, 0}, {3, 2}];
Graphics[{ℛ, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Cylinder can be used in 3D:
RegionCentroid[Cylinder[{{Subscript[x, 1], Subscript[y, 1], Subscript[z, 1]}, {Subscript[x, 2], Subscript[y, 2], Subscript[z, 2]}}, r]]ℛ = Cylinder[{{0, 0, 0}, {0, 0, 2}}, 1];
Graphics3D[{{Opacity[0.5], ℛ}, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Cone can be used in 3D:
RegionCentroid[Cone[{{Subscript[x, 1], Subscript[y, 1], Subscript[z, 1]}, {Subscript[x, 2], Subscript[y, 2], Subscript[z, 2]}}, r]]ℛ = Cone[{{0, 0, 0}, {0, 0, 2}}, 1];
Graphics3D[{{Opacity[0.5], ℛ}, Red, Point[RegionCentroid[ℛ]]}]RegionCentroid[ℛ]Formula Regions (2)
The centroid of a disk represented as an ImplicitRegion:
RegionCentroid[ImplicitRegion[x^2 + y^2 ≤ 1, {x, y}]]RegionCentroid[ImplicitRegion[x^2 + y^2 ≤ 1, {x, y, {z, 0, 2}}]]The centroid of a disk represented as a ParametricRegion:
RegionCentroid[ParametricRegion[{r Cos[θ], r Sin[θ]}, {{r, 0, 1}, {θ, 0, 2π}}]]Using a rational parameterization of the disk:
RegionCentroid[ParametricRegion[{r(1 - t^2/1 + t^2), r(2t/1 + t^2)}, {t, {r, 0, 1}}]]RegionCentroid[ParametricRegion[{r Cos[θ], r Sin[θ], z}, {{r, 0, 1}, {θ, 0, 2π}, {z, 0, 2}}]]Mesh Regions (2)
The centroid of a MeshRegion:
ℛ = DelaunayMesh[RandomReal[1, {10, 2}]];c = RegionCentroid[ℛ]Show[ℛ, Graphics[{Red, Point[c]}]]ℛ = MeshRegion[{{0, 0}, {1, 0}, {2, -1}, {2, 1}}, {Line[{{1, 2, 3, 4, 2}}]}];c = RegionCentroid[ℛ]Show[ℛ, Graphics[{Red, Point[c]}]]ℛ = DelaunayMesh[RandomReal[1, {20, 3}]];c = RegionCentroid[ℛ]Show[HighlightMesh[ℛ, Style[2, Opacity[0.15]]], Graphics3D[{Red, PointSize[Medium], Point[c]}]]The centroid of a BoundaryMeshRegion:
ℛ = ConvexHullMesh[RandomReal[1, {10, 2}]];c = RegionCentroid[ℛ]Show[ℛ, Graphics[{Red, Point[c]}]]ℛ = ConvexHullMesh[RandomReal[1, {20, 3}]];c = RegionCentroid[ℛ]Show[HighlightMesh[ℛ, Style[2, Opacity[0.25]]], Graphics3D[{Red, PointSize[Medium], Point[c]}]]Derived Regions (5)
The centroid of a RegionIntersection:
ℛ = RegionIntersection[Disk[{0, 0}, 1], Disk[{0, 1}, 1]];c = RegionCentroid[ℛ]Show[DiscretizeRegion[ℛ], Graphics[{Red, Point[c]}]]The centroid of a TransformedRegion:
ℛ = TransformedRegion[Disk[{0, 0}, 1], ShearingTransform[30 Degree, {1, 0}, {0, 1}]];c = RegionCentroid[ℛ]Show[DiscretizeRegion[ℛ, {{-2, 2}, {-1, 1}}], Graphics[{Red, Point[c]}]]The centroid of a RegionBoundary:
ℛ = RegionBoundary[Simplex[2]]c = RegionCentroid[ℛ]Show[DiscretizeRegion[ℛ, {{-1.1, 1.1}, {-1.1, 1.1}}], Graphics[{Red, Point[c]}]]{r1, r2, r3} = {Disk[], ParametricRegion[{{u v, u ^ 2 - v ^ 2}, -1 ≤ u + v ≤ 1}, {u, v}], Simplex[{{0, 0}, {0, 1}, {1, 0}}]};RegionCentroid[BooleanRegion[#1 && (#2 || !#3)&, {r1, r2, r3}]]//Togetherℛ = InverseTransformedRegion[Disk[], {Indexed[#1, 1] + Indexed[#1, 2] + 1, Indexed[#1, 1] - Indexed[#1, 2] + 2}& , 2]RegionCentroid[ℛ]Geographic Regions (2)
The centroid of a polygon with GeoPosition:
ℛ = Polygon[GeoPosition[{{{40.083441, -88.235716}, {40.083607, -88.257488}, {40.082603, -88.257149},
{40.076136999999996, -88.25740499999999}, {40.076178, -88.270888}, {40.076516, -88.271558},
{40.083686, -88.271512}, {40.083659999999995, -88.267046}, ... 33323}, {40.098112, -88.228687},
{40.095216, -88.228627}, {40.095179, -88.238547}, {40.094480999999995, -88.238546},
{40.094508999999995, -88.23267}, {40.094106, -88.232556}, {40.090666999999996, -88.232477},
{40.090741, -88.235745}}}]];RegionCentroid[ℛ]The centroid of a polygon with GeoGridPosition:
ℛ = Polygon[GeoGridPosition[{{{-0.9950503945490105, 1.2366760550756015},
{-0.9952074890903578, 1.2369207053693891}, {-0.9952196732768064, 1.2369073327446167},
{-0.9953160063787643, 1.236848436956935}, {-0.9954141759436825, 1.2369993898475449},
{-0. ... 197645333103}, {-0.9949098578570917, 1.2368130881428654},
{-0.9948663952535768, 1.2367477711687371}, {-0.9948714472169538, 1.2367426500757825},
{-0.9949211061652593, 1.2367089232486177}, {-0.9949439717990124, 1.236746107097628}}}, "Bonne"]];RegionCentroid[ℛ]CSG Regions (2)
The centroid of a CSGRegion in 2D:
ℛ = CSGRegion["Difference", {Disk[], Disk[{0.5, 0.5}]}];c = RegionCentroid[ℛ]Show[ℛ, Graphics[{Red, Point[c]}]]The centroid of a CSGRegion in 3D:
ℛ = CSGRegion["Difference", {Cube[3], Cuboid[{-1, -3, -1}, {3, 3, 3}]}];c = RegionCentroid[ℛ]Show[ℛ, Graphics3D[{Red, Point[c]}]]Subdivision Regions (2)
The centroid of a SubdivisionRegion in 2D:
ℛ = SubdivisionRegion[Rectangle[]];c = RegionCentroid[ℛ]Show[ℛ, Graphics[{Red, Point[c]}]]The centroid of a SubdivisionRegion in 3D:
ℛ = SubdivisionRegion[Cube[]];c = RegionCentroid[ℛ]Show[Region[ℛ, BaseStyle -> {FaceForm[Opacity[0.2]]}], Graphics3D[{Red, Point[c]}]]Applications (5)
Find the center of mass for a mesh region:
gm = ExampleData[{"Geometry3D", "Cow"}, "MeshRegion"]c = RegionCentroid[gm]Show[MeshRegion[gm, BaseStyle -> Opacity[.4]], Graphics3D[{Red, Point@c}]]Compute the center of mass of a region with density given by
and compare to the centroid:
ℛ = Disk[];c1 = RegionCentroid[ℛ]
c2 = Integrate[{x, y}(x - 1)^2(y - 1)^2, {x, y}∈ℛ] / Area[ℛ]Legended[Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[c2], Blue, Point[c1]}], PointLegend[{Red, Blue}, {"Center of Mass", "Centroid"}]]The center of mass is shifted because the density is highest in the lower-left:
ContourPlot[(x - 1)^2(y - 1)^2, {x, y}∈ℛ]Find a perpendicular bisector of a triangle:
pts = {a, b, c} = {{1, 2}, {0, 0}, {3, 0}};circumCenter = RegionCentroid[Circumsphere[pts]];bisector = Line[{circumCenter, RegionCentroid[Line[{a, b}]]}];Visualize circumcenter and bisectors in red:
Graphics[{{LightGray, Circumsphere[pts]}, {LightBlue, Triangle[pts]}, {Dashed, Red, bisector}, {Blue, Point[pts]}, {Red, PointSize[Large], Point[circumCenter]}}]Compute a centroidal Voronoi diagram from a random set of points:
pts = RandomReal[1, {100, 2}];ℛ = VoronoiMesh[pts, {{0, 1}, {0, 1}}];Define a function that computes the centroid of each Voronoi region in a Voronoi mesh:
vcf[pts_] := RegionCentroid /@ MeshPrimitives[VoronoiMesh[pts, {{0, 1}, {0, 1}}], "Faces"];Recursively apply VoronoiMesh to the centroids of the precursive Voronoi regions:
centroids = NestList[vcf, pts, 3];Visualize the Voronoi mesh and centroids at each iteration:
vm = VoronoiMesh[#, {{0, 1}, {0, 1}}]& /@ centroids;The generating point (black) of each Voronoi region converges toward the region's centroid (red):
MapThread[Show[#1, Graphics[{Black, Point[#2], Red, Point[vcf[#2]]}]]&, {vm, centroids}]Estimate the centroid of a region by taking the Mean of a random sampling of points in the region:
ℛ = ConvexHullMesh[RandomReal[1, {10, 2}]];
mf = RegionMember[ℛ];
pts = Select[RandomVariate[UniformDistribution[RegionBounds[ℛ]], 1000], mf];
Show[ℛ, Graphics[Point[pts]]]{c1, c2} = {Mean[pts], RegionCentroid[ℛ]}Show[ℛ, Graphics[{Red, Point[c1], Black, Point[c2]}]]Properties & Relations (3)
RegionCentroid is not necessarily in the region if the region is not convex:
ℛ = Polygon[{{0, 0}, {3, -1}, {1, 0}, {3, 1}}];
c = RegionCentroid[ℛ];
Graphics[{LightBlue, EdgeForm[Gray], ℛ, Red, Point[c]}]RegionCentroid is equivalent to Integrate[p,p∈ℛ]/m with m=RegionMeasure[ℛ]:
ℛ = Sphere[{1, 2, 3}];
m = RegionMeasure[ℛ];{RegionCentroid[ℛ], Integrate[p, p∈ℛ] / m}The centroid for
is given by
when disjoint:
{Subscript[ℛ, 1], Subscript[ℛ, 2]} = {Disk[{0, 0}], Disk[{2, 0}]};{m1, m2} = RegionMeasure /@ {Subscript[ℛ, 1], Subscript[ℛ, 2]};
{c1, c2} = RegionCentroid /@ {Subscript[ℛ, 1], Subscript[ℛ, 2]};(m1 c1 + m2 c2) / (m1 + m2)RegionCentroid[RegionUnion[Subscript[ℛ, 1], Subscript[ℛ, 2]]]//SimplifyPossible Issues (1)
RegionCentroid returns a point with Indeterminate coordinates for a region with infinite RegionMeasure:
ℛ = HalfSpace[{1, 1}, 0];RegionMeasure[ℛ]RegionCentroid[ℛ]See Also
RegionMeasure Integrate MomentOfInertia RegionMoment Mean Expectation GeometricScene
Function Repository: BarycentricCoordinates
Related Guides
History
Text
Wolfram Research (2014), RegionCentroid, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionCentroid.html.
CMS
Wolfram Language. 2014. "RegionCentroid." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionCentroid.html.
APA
Wolfram Language. (2014). RegionCentroid. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionCentroid.html
BibTeX
@misc{reference.wolfram_2026_regioncentroid, author="Wolfram Research", title="{RegionCentroid}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/RegionCentroid.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_regioncentroid, organization={Wolfram Research}, title={RegionCentroid}, year={2014}, url={https://reference.wolfram.com/language/ref/RegionCentroid.html}, note=[Accessed: 12-June-2026]}