nearest test failed. replacing distanceTo with squaredDistanceTo.