Fixes #1726.

Replaces intersectSegmentPolygon and intersectLinePolygon "optimized"
implementations with the more robust implementations used for intersectLine and
intersectSegments