libpysal.cg.point_touches_rectangle

libpysal.cg.point_touches_rectangle(point, rect)[source]

Returns True (1) if the point is in the rectangle or touches it’s boundary, otherwise False (0).

Parameters:
point{libpysal.cg.Point, tuple}

A point or point coordinates.

rectlibpysal.cg.Rectangle

A rectangle.

Returns:
chflagint

1 if point is in (or touches boundary of) rect, otherwise 0.

Examples

>>> rect = Rectangle(0, 0, 10, 10)
>>> a = Point((5, 5))
>>> b = Point((10, 5))
>>> c = Point((11, 11))
>>> point_touches_rectangle(a, rect)
1
>>> point_touches_rectangle(b, rect)
1
>>> point_touches_rectangle(c, rect)
0