# is_ccw_xy

compas.geometry.is_ccw_xy(a, b, c, colinear=False)[source]

Determine if c is on the left of ab when looking from a to b, and assuming that all points lie in the XY plane.

Parameters
• a ([float, float, float] | Point) – Base point defined by XY(Z) coordinates.

• b ([float, float, float] | Point) – First end point defined by XY(Z) coordinates.

• c ([float, float, float] | Point) – Second end point defined by XY(Z) coordinates.

• colinear (bool, optional) – If True, colinear points will return a positive result.

Returns

bool – True if ccw. False otherwise.

References

1

Marsh, C. Computational Geometry in Python: From Theory to Application. Available at: https://www.toptal.com/python/computational-geometry-in-python-from-theory-to-implementation

Examples

>>> print(is_ccw_xy([0,0,0], [0,1,0], [-1, 0, 0]))
True

>>> print(is_ccw_xy([0,0,0], [0,1,0], [+1, 0, 0]))
False

>>> print(is_ccw_xy([0,0,0], [1,0,0], [2,0,0]))
False

>>> print(is_ccw_xy([0,0,0], [1,0,0], [2,0,0], True))
True