Convert polygon contour to counterclockwise vertex ordering
[x2, y2] = poly2ccw(x1, y1)
[x2, y2] = poly2ccw(x1, y1) arranges
the vertices in the polygonal contour (
in counterclockwise order, returning the result in
y1 can contain multiple
contours, represented either as
or as cell arrays, then each contour is converted to clockwise ordering.
the same format (
NaN-separated vectors or cell
Convert a clockwise-ordered square to counterclockwise ordering.
x1 = [0 0 1 1 0]; y1 = [0 1 1 0 0]; ispolycw(x1, y1) ans = 1 [x2, y2] = poly2ccw(x1, y1); ispolycw(x2, y2) ans = 0