True if polygon vertices are in clockwise order
tf = ispolycw(x, y)
tf = ispolycw(x, y) returns
true if the polygonal contour vertices represented by
ordered in the clockwise direction.
numeric vectors with the same number of elements.
contain multiple contours, either in
vector form or in cell array form. In that case,
a logical array containing one true or false value per contour.
ispolycw always returns true for polygonal
contours containing two or fewer vertices.
Vertex ordering is not well defined for self-intersecting polygonal
contours. For such contours,
ispolycw returns a
result based on the order or vertices immediately before and after
the left-most of the lowest vertices. In other words, of the vertices
with the lowest
y value, find the vertex with the
x value. For a few special cases of self-intersecting
contours, the vertex ordering cannot be determined using only the
left-most of the lowest vertices; for these cases,
a signed area test to determine the ordering.
y may be any numeric
Orientation of a square:
x = [0 1 1 0 0]; y = [0 0 1 1 0]; ispolycw(x, y) % Returns 0 ispolycw(fliplr(x), fliplr(y)) % Returns 1