Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def calculate_area(c):
Calculates the area of any quadrivaletral
from a list of x,y coordinates in the following format:
first = c[0][0]*c[1][1] + c[1][0]*c[2][1] + c[2][0]*c[3][1] + c[3][0]*c[0][1]
second = c[1][0]*c[0][1] + c[2][0]*c[1][1] + c[3][0]*c[2][1] + c[0][0]*c[3][1]
area = 0.5*(first - second)
return area
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment