Polygonal chain intersection
A generic solution to polygon clipping