Slides the coordinates so that the id-th coordinate, or a particular landmark, become the first one.

coo_slide(
  x,
  id,
  ldk,
  from_col = coo,
  ldk_col = ldk,
  to_col = {     {         from_col     } },
  ...
)

Arguments

x

coo_single, coo_list or mom_tbl

id

integer which is (column row) should be used as the first point

ldk

integer which landkmark should be used as the first point

from_col, ldk_col

colnames from where to get the coo_list

to_col

colname where to set the result (default to from_col) and how to name the resulting one (only for mom_tbl method)

...

useless here

Value

a coo_single, coo_list or mom_tbl

Details

For mom_tbl objects, three different flavours exist:

  • no ldk passed and a single id is passed: all id-th points within the shapes will become the first points.

  • no ldk passed and a vector of ids of nrow(x): for every shape, the id-th point will be used as the id-th point.

  • a single ldk is passed: the ldk-th ldk will be used to slide every shape. If an id is (also) passed, it is ignored with a message. See examples.

ldk handling is only supported on mom_tbl objects.

See also

Examples

h <- hearts %>% dplyr::slice(1:5) # for speed sake pile(h)
h %>% coo_slide(ldk=1) %>% pile()
#> coo_slide: id not provided, working on ldk