libpysal.cg.is_collinear

libpysal.cg.is_collinear(p1, p2, p3)[source]

Returns whether a triplet of points is collinear.

Parameters:
p1libpysal.cg.Point

A point.

p2libpysal.cg.Point

A point.

p3libpysal.cg.Point

A point.

Returns:
collinearbool

True if {p1, p2, p3} are collinear, otherwise False.

Examples

>>> is_collinear(Point((0, 0)), Point((1, 1)), Point((5, 5)))
True
>>> is_collinear(Point((0, 0)), Point((1, 1)), Point((5, 0)))
False