libpysal.cg.get_segments_intersect¶
- libpysal.cg.get_segments_intersect(seg1, seg2)[source]¶
Returns the intersection of two segments if one exists.
- Parameters:
- seg1
libpysal.cg.LineSegment
A segment to check for an intersection.
- seg2
libpysal.cg.LineSegment
The segment to check against
seg1
for an intersection.
- seg1
- Returns:
- intersection{
libpysal.cg.Point
,libpysal.cg.LineSegment
,None
} The intersecting point or line between
seg1
andseg2
if an intersection exists orNone
ifseg1
andseg2
do not intersect.
- intersection{
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)