Fixed shortestDistanceOnTorus.