How is density of an object calculated?