The emphasis here is on the mesh being simple and closed. Make sure to validate these preconditions before relying on the output.
Similar formulas exist for moments, to compute the inertia matrix for a rigid body.