Interpolates and smooths a 2D curve at new arc length
interpolate_points_df.RdFor a 2D curve with (x,y) coordinates parameterized by the arc length, interpolate new (x,y) coordinates at new arc lengths. Smooth the input data with a smoothing spline.
Usage
interpolate_points_df(
.data,
arclen,
x,
y,
arclen_out = NULL,
spar = 0.8,
tailmethod = "extrapolate",
fill_gaps = 0,
.suffix = "_s",
.out = NULL,
overwrite = TRUE,
.frame = frame,
.point = point
)Arguments
- .data
Data frame
- arclen
Name of the input arc length column in
.data- x, y
Name of the columns that contain the coordinates of points on the curve
- arclen_out
Vector containing the new arc length
- spar
Smoothing parameter (ranges from 0 for no smoothing to 1 for high smoothing; see
smooth.spline()for more details.)- tailmethod
('keep', 'extrapolate', or 'NA') Methods to estimate the position of the tail tip if the last value of
arclength_outis longer than the maximum arc length in the current frame.'keep' to keep the existing tail point, even if it is not at the requested arc length
'extrapolate' to extrapolate a tail tip position, assuming that the curve continues straight
'NA' to use replace the tail point with NA in this case.
- fill_gaps
Fill internal missing points of this size or smaller. (0, default, means no filling; 1 means to fill single missing points)
- .suffix
(default = '_s') Suffix to append to the names of the arclen, x, and y columns after smoothing and interpolation.
- .out
Names of the output columns. Defaults are (arclen = 'arclen_s', xs = 'xs', ys = 'ys'). Overrides the
.suffixparameter if it is included.- overwrite
TRUE or FALSE to overwrite existing columns
- .frame
Name of the frame variable in the data frame
- .point
Name of the point variable in the data frame