Fixed a bug in the calculation of the distance to a circular border.

Let's say it was a typo. Or fatigue.