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 (sequence of float) – XY(Z) coordinates of the base point.
b (sequence of float) – XY(Z) coordinates of the first end point.
c (sequence of float) – XY(Z) coordinates of the second end point.
colinear (bool, optional) – Allow points to be colinear. Default is
False.
- Returns
bool –
Trueif ccw.Falseotherwise.
Notes
For more info, see 1.
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