Clean up squaredDistanceToSegment and closestOnSegment

Since we do not use the 'along' property anywhere, and the resulting array returned by closestOnSegment could cause trouble when working with 3d coodinates, the new `footOfPerpendicularToSegment` function does exactly what it says, and the squared distance to a segment is calculated using the `squaredDistance` function instead.

The `squaredDistanceToSegment` function is moved to the `ol.coordinate` package, so it lives next to the functions it depends on.