make sure squaredDistanceToSegment does not divide by zero
Merge pull request #1113 from bartvde/distance

make sure distanceSquaredToSegment does not divide by zero and return NaN as the distance (r=@ahocevar)