sortPointsRectangle {utilitiesR} | R Documentation |
sort vertices in a rectangle in anticlockwise fashion.
sortPointsRectangle(pts, anticlockwise = TRUE, verbose = FALSE, shift = FALSE, preserveStart = FALSE, index.return = FALSE)
pts |
the input points, nx2, colnames 'X' and 'Y' |
anticlockwise |
boolean, whether to return points in anticlockwise or clockwise fashion (default TRUE) |
verbose |
default FALSE, whether to print results |
shift |
default FALSE, whether to return results relative to origin |
preserveStart |
default FALSE, whether to start at the first input coordinate and proceed anticlockwise/ clockwise from there, or to start from the lower-left corner ('origin') |
index.return |
default FALSE, whether to return the indices into the original "pts" that reorder as specified. |
the pts structure with columns 'X','Y', and rows sorted in anticlockwise or clockwise order. If "index.return" is TRUE, returns a list:
the points array
indices into "pts" that reorder it into output$x
Additionally, the row-names of the output are labelled "bottom-left", "bottom-right", "top-left", and "top-right", based on an X-Y coordinate system, 0 being in the bottom left, increasing moving left-to-right and bottom-to-top.