Tests and optionally correct for redundant vertices in a polygon.
The other functions test some features of a polygon.
revPolygon reverses the order of the vertices (i.e., swiching
between clockwise and counterclockwise orders).
redundantVertices(x, tol = 1e-8, check.only = FALSE)
is.clockwise(x)
is.convex(x)
is.open(x)
revPolygon(x, copy = TRUE)redundantVertices returns a two-column numeric matrix, or
nothing if check.only = TRUE (the diagnostics are printed in
the console).
is.clockwise, is.convex, and is.open return a
single logical value.
revPolygon returns by default a two-column numeric matrix, or
nothing if copy = FALSE (the first argument is modified).
a two-column matrix.
the tolerance to consider two vertices identical.
a logical value.
by default, a new polygon is created; if FALSE, the
vertex order is reversed within the same object.
Emmanuel Paradis
If check.only is TRUE, the first function prints the
diagnostics and nothing is returned. Otherwise, the possibly corrected
matrix is returned.
The method for is.clockwise is from:
haveOverlap