# SplineFitter Class Reference

SplineFitter provides routines for performing cubic spline interpolation. More...

`#include <SplineFitter.h>`

List of all members.

## Static Public Member Functions

static void | createNaturalSpline (const std::vector< double > &x, const std::vector< double > &y, std::vector< double > &deriv)
| Fit a natural cubic spline to a set of data points.
static void | createPeriodicSpline (const std::vector< double > &x, const std::vector< double > &y, std::vector< double > &deriv)
| Fit a periodic cubic spline to a set of data points.
static double | evaluateSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &deriv, double t)
| Evaluate a 1D spline generated by one of the other methods in this class.
static double | evaluateSplineDerivative (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &deriv, double t)
| Evaluate the derivative of a 1D spline generated by one of the other methods in this class.
static void | create2DNaturalSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &values, std::vector< std::vector< double > > &c)
| Fit a natural cubic spline surface f(x,y) to a 2D set of data points.
static double | evaluate2DSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &values, const std::vector< std::vector< double > > &c, double u, double v)
| Evaluate a 2D spline generated by one of the other methods in this class.
static void | evaluate2DSplineDerivatives (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &values, const std::vector< std::vector< double > > &c, double u, double v, double &dx, double &dy)
| Evaluate the derivatives of a 2D spline generated by one of the other methods in this class.
static void | create3DNaturalSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &values, std::vector< std::vector< double > > &c)
| Fit a natural cubic spline surface f(x,y,z) to a 3D set of data points.
static double | evaluate3DSpline (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &values, const std::vector< std::vector< double > > &c, double u, double v, double w)
| Evaluate a 3D spline generated by one of the other methods in this class.
static void | evaluate3DSplineDerivatives (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, const std::vector< double > &values, const std::vector< std::vector< double > > &c, double u, double v, double w, double &dx, double &dy, double &dz)
| Evaluate the derivatives of a 3D spline generated by one of the other methods in this class.

## Detailed Description

SplineFitter provides routines for performing cubic spline interpolation.

## Member Function Documentation

static void create2DNaturalSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | values,
|  | std::vector< std::vector< double > > & | c |
| ) |  |  | `[static]`

Fit a natural cubic spline surface f(x,y) to a 2D set of data points.

The resulting spline interpolates all the data points, has a continuous second derivative everywhere, and has a second derivative of 0 at the boundary.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate. They must be strictly increasing: x[i] > x[i-1].
  | y | the values of the second independent variable at the data points to interpolate. They must be strictly increasing: y[i] > y[i-1].
  | values | the values of the dependent variable at the data points to interpolate. They must be ordered so that values[i+xsize*j] = f(x[i],y[j]), where xsize is the length of x.
  | c | on exit, this contains the spline coefficients at each of the data points

static void create3DNaturalSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | z,
|  | const std::vector< double > & | values,
|  | std::vector< std::vector< double > > & | c |
| ) |  |  | `[static]`

Fit a natural cubic spline surface f(x,y,z) to a 3D set of data points.

The resulting spline interpolates all the data points, has a continuous second derivative everywhere, and has a second derivative of 0 at the boundary.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate. They must be strictly increasing: x[i] > x[i-1].
  | y | the values of the second independent variable at the data points to interpolate. They must be strictly increasing: y[i] > y[i-1].
  | z | the values of the third independent variable at the data points to interpolate. They must be strictly increasing: z[i] > z[i-1].
  | values | the values of the dependent variable at the data points to interpolate. They must be ordered so that values[i+xsize*j+xsize*ysize*k] = f(x[i],y[j],z[k]), where xsize is the length of x and ysize is the length of y.
  | c | on exit, this contains the spline coefficients at each of the data points

static void createNaturalSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | std::vector< double > & | deriv |
| ) |  |  | `[static]`

Fit a natural cubic spline to a set of data points.

The resulting spline interpolates all the data points, has a continuous second derivative everywhere, and has a second derivative of 0 at its end points.

Parameters:

  | x | the values of the independent variable at the data points to interpolate. They must be strictly increasing: x[i] > x[i-1].
  | y | the values of the dependent variable at the data points to interpolate
  | deriv | on exit, this contains the second derivative of the spline at each of the data points

static void createPeriodicSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | std::vector< double > & | deriv |
| ) |  |  | `[static]`

Fit a periodic cubic spline to a set of data points.

The resulting spline interpolates all the data points, has a continuous second derivative everywhere, and has identical second derivatives at the end points.

Parameters:

  | x | the values of the independent variable at the data points to interpolate. They must be strictly increasing: x[i] > x[i-1].
  | y | the values of the dependent variable at the data points to interpolate. The first and last entries must be identical.
  | deriv | on exit, this contains the second derivative of the spline at each of the data points

static double evaluate2DSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | values,
|  | const std::vector< std::vector< double > > & | c,
|  | double | u,
|  | double | v |
| ) |  |  | `[static]`

Evaluate a 2D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate
  | y | the values of the second independent variable at the data points to interpolate
  | values | the values of the dependent variable at the data points to interpolate
  | c | the vector of spline coefficients that was calculated by one of the other methods
  | u | the value of the first independent variable at which to evaluate the spline
  | v | the value of the second independent variable at which to evaluate the spline

Returns:
  the value of the spline at the specified point

static void evaluate2DSplineDerivatives | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | values,
|  | const std::vector< std::vector< double > > & | c,
|  | double | u,
|  | double | v,
|  | double & | dx,
|  | double & | dy |
| ) |  |  | `[static]`

Evaluate the derivatives of a 2D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate
  | y | the values of the second independent variable at the data points to interpolate
  | values | the values of the dependent variable at the data points to interpolate
  | c | the vector of spline coefficients that was calculated by one of the other methods
  | u | the value of the first independent variable at which to evaluate the spline
  | v | the value of the second independent variable at which to evaluate the spline
  | dx | on exit, the x derivative of the spline at the specified point
  | dy | on exit, the y derivative of the spline at the specified point

static double evaluate3DSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | z,
|  | const std::vector< double > & | values,
|  | const std::vector< std::vector< double > > & | c,
|  | double | u,
|  | double | v,
|  | double | w |
| ) |  |  | `[static]`

Evaluate a 3D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate
  | y | the values of the second independent variable at the data points to interpolate
  | z | the values of the third independent variable at the data points to interpolate
  | values | the values of the dependent variable at the data points to interpolate
  | c | the vector of spline coefficients that was calculated by one of the other methods
  | u | the value of the first independent variable at which to evaluate the spline
  | v | the value of the second independent variable at which to evaluate the spline
  | w | the value of the third independent variable at which to evaluate the spline

Returns:
  the value of the spline at the specified point

static void evaluate3DSplineDerivatives | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | z,
|  | const std::vector< double > & | values,
|  | const std::vector< std::vector< double > > & | c,
|  | double | u,
|  | double | v,
|  | double | w,
|  | double & | dx,
|  | double & | dy,
|  | double & | dz |
| ) |  |  | `[static]`

Evaluate the derivatives of a 3D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the first independent variable at the data points to interpolate
  | y | the values of the second independent variable at the data points to interpolate
  | z | the values of the third independent variable at the data points to interpolate
  | values | the values of the dependent variable at the data points to interpolate
  | c | the vector of spline coefficients that was calculated by one of the other methods
  | u | the value of the first independent variable at which to evaluate the spline
  | v | the value of the second independent variable at which to evaluate the spline
  | w | the value of the third independent variable at which to evaluate the spline
  | dx | on exit, the x derivative of the spline at the specified point
  | dy | on exit, the y derivative of the spline at the specified point
  | dz | on exit, the z derivative of the spline at the specified point

static double evaluateSpline | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | deriv,
|  | double | t |
| ) |  |  | `[static]`

Evaluate a 1D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the independent variable at the data points to interpolate
  | y | the values of the dependent variable at the data points to interpolate
  | deriv | the vector of second derivatives that was calculated by one of the other methods
  | t | the value of the independent variable at which to evaluate the spline

Returns:
  the value of the spline at the specified point

static double evaluateSplineDerivative | ( | const std::vector< double > & | x,
|  | const std::vector< double > & | y,
|  | const std::vector< double > & | deriv,
|  | double | t |
| ) |  |  | `[static]`

Evaluate the derivative of a 1D spline generated by one of the other methods in this class.

Parameters:

  | x | the values of the independent variable at the data points to interpolate
  | y | the values of the dependent variable at the data points to interpolate
  | deriv | the vector of second derivatives that was calculated by one of the other methods
  | t | the value of the independent variable at which to evaluate the spline

Returns:
  the value of the spline's derivative at the specified point

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

- SplineFitter.h