libpysal.cg.get_ray_segment_intersect¶
- libpysal.cg.get_ray_segment_intersect(ray, seg)[source]¶
Returns the intersection of a ray and line segment.
- Parameters:
- ray
libpysal.cg.Ray
A ray to check for an intersection.
- seg
libpysal.cg.LineSegment
A segment to check for an intersection against
ray
.
- ray
- Returns:
- intersection{
libpysal.cg.Point
,libpysal.cg.LineSegment
,None
} The intersecting point or line between
ray
andseg
if an intersection exists orNone
ifray
andseg
do not intersect.
- intersection{
See also
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)