pysal.lib.cg.get_segments_intersect

pysal.lib.cg.get_segments_intersect(seg1, seg2)[source]

Returns the intersection of two segments.

get_segments_intersect(LineSegment, LineSegment) -> Point or LineSegment

Parameters:
seg1 : a segment to check intersection for
seg2 : a segment to check intersection for

Examples

>>> seg1 = LineSegment(Point((0, 0)), Point((0, 10)))
>>> seg2 = LineSegment(Point((-5, 5)), Point((5, 5)))
>>> i = get_segments_intersect(seg1, seg2)
>>> isinstance(i, Point)
True
>>> str(i)
'(0.0, 5.0)'
>>> seg3 = LineSegment(Point((100, 100)), Point((100, 101)))
>>> i = get_segments_intersect(seg2, seg3)