splineCR: Interpolate using Catmull-Rom spline

Description Usage Arguments Details Value References Examples

View source: R/splineCR.R

Description

Perform path interpolation using the Catumull-Rom spline interpolation method.

Usage

1
splineCR(xyt, t.slice)

Arguments

xyt

a 4x3 dataframe containing the coordinates and times for the four control points. Each row of the dataframe should be arranged as x, y, t.

t.slice

a single time (POSIX or numeric), or list of times, to be interpolated for. The times must lie between those of the middle two control points (i.e., the times associated with rows 2 & 3 in the xyt dataframe).

Details

Catmull-Rom splines can be useful for interpolating movement when the object exhibits curvi-linear movement shapes (Long 2015). For example, hurricanes often exhibit this property. The Catmull-Rom method requires four control points (2-D coordinates) as input, along with their corresponding times (Barry & Goldman 1988); these four points are passed to the function as a dataframe with four rows, and three columns corresponding to x, y, & t (the names of the columns do not matter). The function interpolates the movement trajectory for the times indicated by parameter t.slice. The t.slice times must lie between the time of the 2nd and 3rd control point. Times can be passed in as either POSIX-class objects or numeric, but not a mixture of both.

Value

The function returns a dataframe (with nrow = length{t.slice}) corresponding to the interpolated locations.

References

Long, JA (2015) Kinematic interpolation of movement data. International Journal of Geographical Information Science. DOI: 10.1080/13658816.2015.1081909.

Barry, PJ, Goldman, RN (1988) A recursive evaluation algorithm for a class of Catmull-Rom splines. ACM SIGGRAPH Computer Graphics. 22(4): 199-204.

Examples

1
2
3
4
5
6
7
data(contrived)
xyt <- contrived
###times for interpolation
t.slice <- c(1.5,2,2.5,3,3.5,4,4.5,5,5.5)
a <- splineCR(xyt,t.slice)
plot(xyt[,1],xyt[,2],pch=20)
points(a[,1],a[,2])

jedalong/PathInterpolatR documentation built on May 19, 2019, 12:40 a.m.