% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shape.R
\name{add_shape_descriptors}
\alias{add_shape_descriptors}
\title{Adds shape descriptors to a streamline or bundle}
\usage{
add_shape_descriptors(
  x,
  descriptors = c("euclidean_length", "curvilinear_length", "sinuosity", "curvature",
    "torsion")
)
}
\arguments{
\item{x}{A \link{streamline} or \link{bundle} object.}

\item{descriptors}{A character vector of shape descriptors to add. Defaults
to all available descriptors: \code{c("euclidean_length", "curvilinear_length", "sinuosity", "curvature", "torsion")}.}
}
\value{
An object of the same class as \code{x} with the specified shape descriptors
added to the \verb{@streamline_data} or \verb{@point_data} slots of each streamline.
}
\description{
\code{add_shape_descriptors()} is an S7 generic that computes a number of shape
descriptors for each \link{streamline} object and stores them in the
\verb{@streamline_data} or \verb{@point_data} slots as appropriate, with methods
available for the following classes:

\itemize{
\item \code{\link[=add_shape_descriptors-fiber-bundle-method]{fiber::bundle}}
\item \code{\link[=add_shape_descriptors-fiber-streamline-method]{fiber::streamline}}
}

This function provides a convenient way to compute shape descriptors and
attach them to \link{streamline} or \link{bundle} objects. See the documentation for
each individual shape descriptor function (e.g. \code{get_euclidean_length()},
\code{get_curvilinear_length()}, \code{get_sinuosity()}, \code{get_curvature()},
\code{get_torsion()}) for more details on how each descriptor is computed.
}
\examples{
# add multiple shape descriptors to a single streamline
pts <- matrix(runif(30), ncol = 3)
colnames(pts) <- c("X", "Y", "Z")
sl <- streamline(points = pts)
sl <- add_shape_descriptors(
  sl,
  descriptors = c("euclidean_length", "curvilinear_length", "sinuosity")
)
# add multiple shape descriptors to a bundle
sl1 <- streamline(points = pts)
pts2 <- matrix(runif(60), ncol = 3)
colnames(pts2) <- c("X", "Y", "Z")
sl2 <- streamline(points = pts2)
b <- bundle(streamlines = list(sl1, sl2))
b <- add_shape_descriptors(
  b,
  descriptors = c("euclidean_length", "curvilinear_length", "sinuosity")
)
}
