Geometry: Added distanceSquaredToSegment() function

This function doesn't have the overhead of the Math.sqrt() and can be used more efficiently for comparisons.