>>> from punt2D import Punt2D >>> from poligon import Poligon >>> from area import area >>> pol = Poligon() >>> area(pol) 0 >>> p = Punt2D(0, 0) >>> pol.afegir_vertex(p) >>> p = Punt2D(1, 0) >>> pol.afegir_vertex(p) >>> p = Punt2D(1, 1) >>> pol.afegir_vertex(p) >>> p = Punt2D(0, 1) >>> pol.afegir_vertex(p) >>> print('{:.2f}'.format(area(pol))) 1.00 >>> pol[2].y = 2 >>> print('{:.2f}'.format(area(pol))) 1.50 >>> pol[1].y = -2 >>> print('{:.2f}'.format(area(pol))) 2.50 >>> pol.afegir_vertex(Punt2D(-2, 0)) >>> print('{:.2f}'.format(area(pol))) 3.50