accurate calculation of the centroid for small objects with large coordinates (p=sdikiy,r=marcjansen,sbrunner)