Optimized intersectLinePolygon. Added intersectSegmentPolygon.