POLYGONLOOPS Divide a possibly self-intersecting polygon into a set of simple loops.
LOOPS = polygonLoops(POLYGON);
POLYGON is a polygone defined by a series of vertices,
LOOPS is a cell array of polygons, containing the same vertices of the
original polygon, but no loop self-intersect, and no couple of loops
intersect each other.
Example:
poly = [0 0;0 10;20 10;20 20;10 20;10 0];
loops = polygonLoops(poly);
figure(1); hold on;
drawPolygon(loops);
polygonArea(loops)
See also
polygons2d, polygonSelfIntersections
Package: matgeom