polygon_line_intersections(px, py, xval=None, yval=None)¶
Find all the segments of intersection between a polygon and an infinite horizontal/vertical line.
The polygon is assumed to be closed. Due to numerical precision, the behavior at the edges of polygons is not always predictable, i.e. a point on the edge of a polygon may be considered inside or outside the polygon.
px, py : ~numpy.ndarray
The vertices of the polygon
xval : float, optional
The x coordinate of the line (for vertical lines). This should only be specified if yval is not specified.
yval : float, optional
The y coordinate of the line (for horizontal lines). This should only be specified if xval is not specified.
segments : list
A list of segments given as tuples of coordinates along the line.