squaredDistanceToSegment and footOfPerpendicularToSegment

In addition to getting the squared distance of a point to a segment, it may also be necessary to get the foot of the perpendicular of that point to the segment. The new `footOfPerpendicularToSegment` function does exactly what it says, and the squared distance to a segment is now calculated using this new function and `squaredDistance` instead.

The `squaredDistanceToSegment` function is moved to the `ol.coordinate` package, so it lives next to the functions it depends on.