Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Gauss's area formula solution in Clear category for Area of a Convex Polygon by kdim
def checkio(data): # Gauss's area formula
x, y = zip(*data) # https://en.wikipedia.org/wiki/Shoelace_formula
a = sum(i * j for i, j in zip(x, y[1:] + y[:1]))
b = sum(i * j for i, j in zip(x[1:] + x[:1], y))
return abs(a - b) / 2 # work only for (clockwise or anticlockwise) sequence
Feb. 10, 2021
Comments: