Learn R Programming

SimilarityMeasures (version 1.4)

AveTranslate: Create an Average Point Translation Vector

Description

A function to calculate a translation vector for trajectory2 using the average of the two trajectories. The vector created can be used to translate the average of trajectory2's points to that of trajectory1.

Usage

AveTranslate(traj1, traj2)

Arguments

traj1
An m x n matrix containing trajectory1. Here m is the number of points and n is the dimension of the points.
traj2
A k x n matrix containing trajectory2. Here k is the number of points and n is the dimension of the points. The two trajectories are not required to have the same number of points.

Value

A vector of length n is returned containing the translation in each dimension. If there is a problem this returns a string of information instead.

Details

The average of each dimension of both trajectories is calculated. The required translation is then calculated from the difference between them.

See Also

LCSSTranslation, StartEndTranslate

Examples

Run this code
# Creating two trajectories.
path1 <- matrix(c(0, 1, 2, 3, 0, 1, 2, 3), 4)
path2 <- matrix(c(0, 1, 2, 3, 4, 5, 6, 7), 4)

# Running the translation.
AveTranslate(path1, path2)

Run the code above in your browser using DataLab