Skip to content

polyarea

general · scripts/general/polyarea.m

: a = polyarea (x, y)
: a = polyarea (x, y, dim)

Area enclosed by a polygon.

x and y hold the vertex coordinates in order around the boundary and must have the same shape. For vectors a single area is returned. For matrices each column is a separate polygon and one area per column is returned; dim selects another dimension along which the vertices are listed. The area is computed with the shoelace formula, so it is correct for any simple polygon, convex or not.