The center of gravity is calculated using two equations, the x coordinate is calculated by x = sum of (mi * xi) / sum of mi. The y coordinate is calculated as y = sum of (mi * yi) / sum of mi. Sometimes the z coordinate is also calculated.
The center of gravity for a uniform mass, such as a rectangle or a triangle, is given by a formula, such as "h / 3" for a triangle. A non-uniform mass has a center of gravity given by a double integral for a plane figure and by a triple integral for a three-dimensional object.