The physics
A body balances on a pivot right under its centre of mass. There, the turning pulls of its two sides match.
For point masses, measure every place from one end. Multiply each mass by its place, add, and divide by the total mass. A uniform rod's own mass acts at its middle.
x = (m₁x₁ + m₂x₂ + …) / (m₁ + m₂ + …)
When the mass spreads out, cut the body into thin bits and integrate. For a rod, dm = λ dx. For a sheet, dm = σ × the strip's area.
x = ∫ x dm / ∫ dm
For a sheet made of simple pieces, use each piece's area as its mass. A hole is a piece with a negative mass.
A toy can stand on a hemisphere. It rests at any tilt when its centre of mass sits at O. O is the centre of the flat face. Below O, the toy rocks back upright.
solid cone: h/4 above its base solid hemisphere: 3R/8 below its flat face