added jean's functions to compute distance from the centroid of an object to camera origin