sortPointsRectangle {utilitiesR}R Documentation

sort vertices in a rectangle in anticlockwise fashion.

Description

sort vertices in a rectangle in anticlockwise fashion.

Usage

  sortPointsRectangle(pts, anticlockwise = TRUE,
    verbose = FALSE, shift = FALSE, preserveStart = FALSE,
    index.return = FALSE)

Arguments

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.

Value

the pts structure with columns 'X','Y', and rows sorted in anticlockwise or clockwise order. If "index.return" is TRUE, returns a list:

x

the points array

ix

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.


[Package utilitiesR version 1.8.4 Index]