def area_by_shoelace(x, y):
"Assumes x,y points go around the polygon in one direction"
return abs( sum(i * j for i, j in zip(x, y[1:])) + x[-1] * y
-sum(i * j for i, j in zip(x[1:], y)) - x * y[-1]) / 2
| Contact Us
© 2021 ActiveState Software Inc. All rights reserved.
ActiveState®, Komodo®, ActiveState Perl Dev Kit®,
ActiveState Tcl Dev Kit®, ActivePerl®, ActivePython®,
and ActiveTcl® are registered trademarks of ActiveState.
All other marks are property of their respective owners.