Drake
InverseFunctionInterpolator Class Reference

A linear interpolator for arbitrary inverse functions. More...

#include <drake/automotive/maliput/rndf/spline_helpers.h>

Public Member Functions

 InverseFunctionInterpolator (std::function< double(double)> function, double xmin, double xmax, double error_boundary)
 Constructor that takes the function, its domain interval and an error boundary for the interpolation. More...
 
double InterpolateMthDerivative (int derivative_order, double y)
 Interpolates \( x^{(derivative_order)}(y) \), that is, the inverse of the given function. More...
 
Does not allow copy, move, or assignment
 InverseFunctionInterpolator (const InverseFunctionInterpolator &)=delete
 
InverseFunctionInterpolatoroperator= (const InverseFunctionInterpolator &)=delete
 
 InverseFunctionInterpolator (InverseFunctionInterpolator &&)=delete
 
InverseFunctionInterpolatoroperator= (InverseFunctionInterpolator &&)=delete
 

Detailed Description

A linear interpolator for arbitrary inverse functions.

Helpful for path-length parameterization with ignition::math::Splines. Given a function F, its domain D, and codomain CD, this class gives a linear interpolant of F's inverse that maps CD to D.

Constructor & Destructor Documentation

InverseFunctionInterpolator ( std::function< double(double)>  function,
double  xmin,
double  xmax,
double  error_boundary 
)
explicit

Constructor that takes the function, its domain interval and an error boundary for the interpolation.

The valid range of function's codomain is determined as follows. The minimum value is xmin applied to function. The maximum value is xmax applied to function. This is valid because function is assumed to be monotonically increasing with x.

Parameters
[in]functionan arbitrary continuous function for which to interpolate an inverse. It should be monotonically increasing with x.
[in]xminfunction 's domain interval low bound.
[in]xmaxfunction 's domain interval upper bound.
[in]error_boundarya positive constraint on the maximum error allowed when approximating the inverse function.
Exceptions
std::runtime_errorWhen error_boundary is not positive.
std::runtime_errorWhen xmin is equal or greater than xmax.
std::runtime_errorWhen evaluating function throws.

Member Function Documentation

double InterpolateMthDerivative ( int  derivative_order,
double  y 
)

Interpolates \( x^{(derivative_order)}(y) \), that is, the inverse of the given function.

Parameters
[in]derivative_ordera non-negative integer describing the order of the inverse function derivative to interpolate. Any value bigger than 1 will make the function return 0.0 as this is a linear interpolant.
[in]ythe range value to interpolate at, constrained by the direct function image, which is inside the codomain of the direct function.
Returns
interpolated derivative_order derivative \( x^{(derivative_order)}(y) \) .
Exceptions
whenderivative_order is a negative integer.
wheny is larger than the maximum range of the function's codomain as described in the constructor's documentation.
std::runtime_errorWhen y is smaller than the minimum range of the function's codomain as described in the constructor's documentation.

Here is the call graph for this function:


The documentation for this class was generated from the following files: