bezier: Interpolate using Bezier curve

Description Usage Arguments Details Value References Examples

View source: R/bezier.r

Description

Perform path interpolation using a Bezier curve interpolation method.

Usage

1
bezier(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

Bezier curves can be useful for interpolating movement when the object exhibits curvi-linear movement shapes (Long 2015). For example, the movements of marine mammals often exhibit this property (Tremblay et al. 2006) . The Bezier method, as implemented here, requires four control points (2-D coordinates) as input, along with their corresponding times; 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.

Tremblay, YC et al. (2006) Interpolation of animal tracking data in a fluid environment. Journal of Experimental Biology. 209(1): 128-140.

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 <- bezier(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.