Skip to contents

Converts a track-like object to the minimal track representation used by gmov. The returned object is a tibble with numeric x_ and y_ columns. Many amt tracks use these coordinate names and should work when they are data-frame-like. This helper intentionally works with simple object shapes and does not depend on amt internals. Coordinates are assumed to be in a common planar coordinate system. gmov does not transform track coordinates.

Usage

as_gmov_track(x, x_col = NULL, y_col = NULL, ...)

Arguments

x

A track-like object. Supported inputs include data frames with x_ and y_ columns, data frames with x and y columns, amt-style step objects with x1_, y1_, x2_, and y2_, and sf point objects. Step objects are converted to the corresponding sequence of segment endpoints.

x_col, y_col

Optional character names of the coordinate columns.

...

Currently unused.

Value

A tibble with at least x_ and y_ columns.

Examples

trk <- data.frame(x = c(0, 1, 2), y = c(0, 1, 1))
as_gmov_track(trk)
#> # A tibble: 3 × 4
#>       x     y    x_    y_
#>   <dbl> <dbl> <dbl> <dbl>
#> 1     0     0     0     0
#> 2     1     1     1     1
#> 3     2     1     2     1