Clean up the kmRay2IntersectLineSegment function