TrajScale {trajr} | R Documentation |
Scale a trajectory
Description
Scales the cartesian coordinates in a trajectory, for example, to convert units from pixels to metres.
Usage
TrajScale(trj, scale, units, yScale = scale)
Arguments
trj |
The trajectory to be scaled. |
scale |
Scaling factor to be applied to the trajectory coordinates. |
units |
Character specifying the spatial units after scaling, e.g. "m" or "metres" |
yScale |
Optional scaling factor to be applied to the y-axis, which may
be specified if the original coordinates are not square. Defaults to
|
Value
new scaled trajectory.
Examples
set.seed(42)
trj <- TrajGenerate()
# original trajectory units are pixels, measured as having
# 47 pixels in 10 mm, so to convert to metres, scale the
# trajectory by the approriate factor, i.e. (size in metres) / (size in pixels).
scale <- .01 / 47
scaled <- TrajScale(trj, scale, "m")
[Package trajr version 1.5.1 Index]