Calculate center of gravity of object