Use dist^2 instead of sqrt(dist^2)

Instead of finding the actual distance, if we're just finding two
farthest or closest points, we can calulate the distance squared using
integers instead of doubles because the maximums and minimums of
sqrt(x^2) and x^2 occur at the same x values, just differing in y
values. This, however, doesn't appear to make any noticable speed up.