mt_align
aligns trajectories to a common start point, end point, and /
or coordinate system.
mt_align(data, use = "trajectories", save_as = use, dimensions = c("xpos", "ypos"), coordinates = "isotropic", align_start = FALSE, align_end = FALSE, align_side = "no", verbose = FALSE)
data  a mousetrap data object created using one of the mt_import
functions (see mt_example for details). Alternatively, a trajectory
array can be provided directly (in this case 

use  a character string specifying which trajectory data should be used. 
save_as  a character string specifying where the resulting trajectory data should be stored. 
dimensions  a character string specifying which trajectory variables should be used. Can be of length 2 or 3 for twodimensional or threedimensional alignment respectively. 
coordinates  either a numeric vector of length 4 specifying the xstart,
ystart, xend, yend coordinates of the trajectory start and end points. Can
also be 
align_start  boolean specifying whether the start points of all
trajectories should be aligned to the position specified in

align_end  boolean specifying whether the end points of all trajectories
should be aligned to the position specified in 
align_side  character string specifying whether all trajectories should
be flipped to the left side ( 
verbose  logical indicating whether function should report its progress. 
A mousetrap data object (see mt_example) with aligned
trajectories. Per default, the dimensions in the original trajectory array
will be replaced. If a different trajectory array is specified using
save_as
, a new trajectory array will be created (including only the
aligned dimensions). If a trajectory array was provided directly as
data
, only the aligned trajectories will be returned.
If align_start
/ align_end
is FALSE
, coordinates
define the position of the average start / end point across all trajectories.
Note that if the end points of trajectories are not aligned, coordinates refer to the hypothetical case where all trajectories are mapped to one side.
If align_start
/ align_end
is TRUE
, the start / end
point of each trajectory is set to the exact position specified in
coordinates
. align_start
and align_end
can be set
completely independently of one another, i.e., one can align only end points,
only start points, none, or both.
If align_start
is set to "left"
or "right"
trajectories
will be flipped to the lower or upper spectrum of the first dimensions,
respectively. If the first dimension is the xcoordinate this is equivalent
to flipping the trajectories to the left and right side, respectively.
mt_align_start for aligning all trajectories to a common start position.
mt_align_start_end for aligning all trajectories so that they share a common initial and final coordinate.
mt_remap_symmetric for remapping trajectories to one side (or one quadrant) of the coordinate system.
mt_example < mt_align(mt_example, align_start = TRUE, align_end = TRUE, coordinates = 'mt')