Learn R Programming

gdi (version 1.10.0)

inter_corr: Helper function for interpolating cross-sectional metrics over the length of a silhouette

Description

Helper function for interpolating cross-sectional metrics over the length of a silhouette

Usage

inter_corr(
  ...,
  x = NULL,
  sil,
  indices = NULL,
  default = 1,
  default_k = 2,
  return = "area_corr",
  v = FALSE
)

Arguments

...

cross-sections between which to interpolate. Each object can be either a single numeric each giving the quantity to be interpolated between, a full output of cscorr() with option return="all", or a character vector giving filenames to use with cscorr().

x

indices along silhouette to use as points of interpolation. If NULL, the function will treat indices as indices of the silhouette itself, not x, and attempt to prepend 1 and append sil (or its length) to it, to make the cross-section interpolate toward the default value at the first and last slice.

sil

dataframe or vector (output of measuresil()) or single numeric giving the total number of slices of the silhouette for which to interpolate cross-sections

indices

subset of x to which the elements in ... pertain, if ... does not have the same total number of elements as x

default

default value to fill for elements of x not in indices, if length(x)>length(...)

default_k

default superellipse exponent to use for elements of x not in indices, supersedes setting for default if not NULL and return parameter is set to "area_corr"

return

which element of the cscorr() output to return in interpolated form (defaults to area_corr, can also be "asp"

v

verbosity setting (logical)

Details

This is a convenience function and wrapper around approx() and cscorr(), which creates a linear interpolation of cross-section geometry over the entire length of a silhouette. Input can in principle be any numeric value (but, is intended to primarily be cross-sectional geometry defined by "area_corr" and "asp" elements returned via cscorr().

Examples

Run this code
fdir <- system.file(package="gdi")
cf <- cscorr(file.path(fdir,"exdata","cross_section.png"))
lat <- measuresil(file.path(fdir,"exdata","lat.png"))
inter_corr(cf,x=c(1,1000,2341), sil=lat, indices=2)

Run the code above in your browser using DataLab