Signed polygon area in matlab

Alec Jacobson

October 30, 2016

weblog/

Suppose you have a polygon's 2D corners stored in P, then the signed area is given by:

signed_polyarea = @(P) 0.5*(P(1:end,1)'*P([2:end 1],2)-P(1:end,2)'*P([2:end 1],1));