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] |
compas.geometry.Point
Base point defined by XY(Z) coordinates.
- b[float, float, float] |
compas.geometry.Point
First end point defined by XY(Z) coordinates.
- c[float, float, float] |
compas.geometry.Point
Second end point defined by XY(Z) coordinates.
- colinearbool, optional
If True, colinear points will return a positive result.
- a[float, float, float] |
- Returns:
- bool
True if ccw. False otherwise.
See also
References
For more info, see [1].
[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