centroid-methods function

return the centroid of an object