Creating function that meassures distances from a given point.