|
Gin
|
Lagrange interpolation functions for obtaining smooth curves from discrete points. More...
Functions | |
| template<typename T > | |
| T | interpolate (const juce::Array< Point< T > > &points, T x) |
| Interpolates a value at coordinate x using Lagrange polynomial interpolation. | |
| template<typename T > | |
| T | interpolate (T xArr[], T yArr[], int num, T x) |
| Interpolates a value at coordinate x using Lagrange polynomial interpolation. | |
Lagrange interpolation functions for obtaining smooth curves from discrete points.
Lagrange interpolation creates a polynomial that passes through all given points. Unlike splines, it uses a single polynomial rather than piecewise functions. Note that for large numbers of points, the resulting polynomial can oscillate significantly (Runge's phenomenon).
| T Lagrange::interpolate | ( | const juce::Array< Point< T > > & | points, |
| T | x | ||
| ) |
Interpolates a value at coordinate x using Lagrange polynomial interpolation.
Creates a polynomial that passes through all the given points and evaluates it at the specified x coordinate. The resulting polynomial has degree n-1 where n is the number of points.
| points | An array of Point<T> defining the interpolation curve |
| x | The x coordinate at which to evaluate the interpolated value |
Referenced by DelayLine::readLagrange(), and DelayLine::readSampleLagrange().
| T Lagrange::interpolate | ( | T | xArr[], |
| T | yArr[], | ||
| int | num, | ||
| T | x | ||
| ) |
Interpolates a value at coordinate x using Lagrange polynomial interpolation.
This overload accepts separate arrays for x and y coordinates rather than an array of points. Creates a polynomial that passes through all the given points and evaluates it at the specified x coordinate.
| xArr | Array of x coordinates |
| yArr | Array of y coordinates (must be same length as xArr) |
| num | Number of points in the arrays |
| x | The x coordinate at which to evaluate the interpolated value |