/usr/lib/python2.7/dist-packages/shapely/algorithms/cga.py is in python-shapely 1.6.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | def signed_area(ring):
"""Return the signed area enclosed by a ring in linear time using the
algorithm at: http://www.cgafaq.info/wiki/Polygon_Area.
"""
xs, ys = ring.coords.xy
xs.append(xs[1])
ys.append(ys[1])
return sum(xs[i]*(ys[i+1]-ys[i-1]) for i in range(1, len(ring.coords)))/2.0
def is_ccw_impl(name):
"""Predicate implementation"""
def is_ccw_op(ring):
return signed_area(ring) >= 0.0
return is_ccw_op
|