Better algorithm to determine the circle position and radius