![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/Curve.h>
Interpolation and fitting of a 1D curve. More...
Interpolation and fitting of a 1D curve.
If no x values are provided, equal-spaced data locations within 0..1 are used. Interpolation is done with Hermite cubic splines and conditioning to avoid overshoot of the curve.
Public Member Functions | |
Curve (const std::vector< double > &y) | |
Creates curve with equal-spaced data values to interpolate. | |
Curve (const std::vector< double > &x, const std::vector< double > &y) | |
Creates curve with arbitrary data positions and values. | |
Curve (const std::vector< vec3 > &points) | |
bool | fit (int n, bool adaptConst=false, bool optimize=false) |
Fit curve using desired dimension, optionally optimizing point locations. | |
const std::vector< double > & | x () const |
Access to the support points of the curve. | |
const std::vector< double > & | y () const |
Access to the function values of the curve. | |
Curve and error evaluation | |
| |
double | evaluate (double x) const |
std::vector< double > | evaluate (const std::vector< double > &x) const |
Evaluate the curve function at multiple locations. | |
void | evaluate (std::vector< vec3 > &points) const |
Evaluate the curve at multiple locations and write the result back in the same vector. | |
std::vector< double > | evaluate (int n) const |
Evaluate the curve with a chosen resolution. | |
double | error (const std::vector< double > &y) const |
Compute the mean error of the curve and the provided regular spaced data. | |
double | error (const std::vector< double > &x, const std::vector< double > &y) const |
Compute the mean error of the curve and the provided data in x and y. | |
bool fit | ( | int | n, |
bool | adaptConst = false, | ||
bool | optimize = false ) |
Fit curve using desired dimension, optionally optimizing point locations.
double evaluate | ( | double | x | ) | const |
Evaluate the curve function at a single location
std::vector< double > evaluate | ( | int | n | ) | const |
Evaluate the curve with a chosen resolution.
The curve is evaluated with n samples in a regular grid defined by the minimum and maximum of the data point locations (not necessarily 0..1).