Polygon clipping function