NB. compute the area of a closed polygon where NB. the vertices are enumerated (counter-clockwise) NB. as (x1, y1), ... (xn, yn) NB. Method due to Goldman in "Triangles", Graphics Gems I, pp 20-23. NB. generalized by Stone in "A Mnemonic for the Area of Polygons, American NB. Math. Monthly 93, pp 479-480. NB. an example polygon [t =: 2 5$ 6 5 2 4 2 2 4 3 3 1 2 NB. the closed example polygon [t1=: t,.{."1 t NB. use oblique to select the major diagonal 1}. _1}. (*/"1) /. t1 area =: monad define y. =. y. ,. {."1 y. 0.5 * (+/ 1}. _1}. (*/"1) /. |. y.)- +/ 1}. _1}. (*/"1) /. y. ) NB. a triangle example [t2 =: 2 3$ 0 1 0 0 0 1 NB. a rectangle example [t3=: 2 4 $ 0 1 1 0 0 0 1 1