Clipping line segments to arbitrary polygons