def signed_area(pr):
    """Return the signed area enclosed by a ring using the linear time
algorithm at http://www.cgafaq.info/wiki/Polygon_Area. A value >= 0
indicates a counter-clockwise oriented ring."""
    xs,ys = pr.exterior.xy
    xs.append(xs[1])
    ys.append(ys[1])
    L = len(xs)

    return sum(xs[i]*(ys[i+1]-ys[i-1]) for i in range(1, L-1))/2.0