calc center of mass