pysal.lib.cg.get_ray_segment_intersect

pysal.lib.cg.get_ray_segment_intersect(ray, seg)[source]

Returns the intersection of a ray and line segment.

get_ray_segment_intersect(Ray, Point) -> Point or LineSegment

Parameters:
ray : a ray to check intersection for
seg : a line segment to check intersection for

Examples

>>> ray = Ray(Point((0, 0)), Point((0, 1)))
>>> seg = LineSegment(Point((-1, 10)), Point((1, 10)))
>>> i = get_ray_segment_intersect(ray, seg)
>>> isinstance(i, Point)
True
>>> str(i)
'(0.0, 10.0)'
>>> seg2 = LineSegment(Point((10, 10)), Point((10, 11)))
>>> get_ray_segment_intersect(ray, seg2)