libpysal.cg.get_segment_point_intersect

libpysal.cg.get_segment_point_intersect(seg, pt)[source]

Returns the intersection of a segment and point.

Parameters:
seglibpysal.cg.LineSegment

A segment to check for an intersection.

ptlibpysal.cg.Point

A point to check seg for an intersection.

Returns:
pt{libpysal.cg.Point, None}

The intersection of a seg and pt if one exists, otherwise None.

Examples

>>> seg = LineSegment(Point((0, 0)), Point((0, 10)))
>>> pt = Point((0, 5))
>>> i = get_segment_point_intersect(seg, pt)
>>> str(i)
'(0.0, 5.0)'
>>> pt2 = Point((5, 5))
>>> get_segment_point_intersect(seg, pt2)