TrajTranslate: Translate a trajectory

View source: R/trajectory.R

TrajTranslateR Documentation

Translate a trajectory

Description

Shifts an entire trajectory by the specified delta x and y.

Usage

TrajTranslate(trj, dx, dy, dt = 0)

Arguments

trj

The Trajectory to be translated.

dx

Delta x.

dy

Delta y.

dt

Delta time.

Value

A new trajectory which is a translated version of the input trajectory.

Examples

# Shift a trajectory so that its origin is (10, 15).
# Note that trajectories created by TrajGenerate always start at (0, 0)
set.seed(42)
trj <- TrajGenerate()
trj <- TrajTranslate(trj, 10, 15)

# Translate a trajectory so its origin (0, 0) and it starts at time 0
trj <- TrajTranslate(trj, -trj$x[1], -trj$y[1], -trj$time[1])


JimMcL/trajr documentation built on July 23, 2024, 2:06 a.m.