Skip to contents

For 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",
  .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_out is 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.

.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 .suffix parameter 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

Value

A data frame with updated columns for the smoothed and iterpolated arc length, x and y coordinates.

Details

Operates on each frame (as defined in the .frame parameter) individually.