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.
Cartesian 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
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 lowest
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,
ispolycw uses 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
You can use
ispolycw for geographic coordinates if the polygon
does not cross the Antimeridian or contain a pole. A polygon contains a pole if the
longitude data spans 360 degrees. To use
ispolycw with geographic
coordinates, specify the longitude vector as
x and the latitude