![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
A class for performing simple x-y-z bilinear interpolation. More...
#include <InterpolateBilinear.h>
Public Member Functions | |
| int | setData (const std::vector< double > &xValues, const std::vector< double > &yValues, const std::vector< std::vector< double > > &zValues) |
| Sets the data for the interpolator. | |
| int | getMinX (double &minX) const |
| Returns the minimum x-value from the stored data. | |
| int | getMaxX (double &maxX) const |
| Returns the maximum x-value from the stored data. | |
| int | getMinY (double &minX) const |
| Returns the minimum y-value from the stored data. | |
| int | getMaxY (double &maxX) const |
| Returns the maximum y-value from the stored data. | |
| int | interpolate (double x, double y, double &zInterpolated) |
| Performs bilinear interpolation given an (x, y) value pair. | |
A class for performing simple x-y-z bilinear interpolation.
This class allows you to store tabulated x, y, and z values, and then to compute interpolated z values for any (x, y) pair within the bounds of the stored data. The bilinear interpolation is performed between successive data points.
Methodology:
Error Handling:
Author: James Tabony james.nosp@m..tab.nosp@m.ony@a.nosp@m.ttx..nosp@m.tech
| int warptwin::InterpolateBilinear::getMaxX | ( | double & | maxX | ) | const |
Returns the maximum x-value from the stored data.
| [out] | maxX | The maximum x-value will be written here if the function succeeds. |
This function returns an error if there is no data stored.
| int warptwin::InterpolateBilinear::getMaxY | ( | double & | maxX | ) | const |
Returns the maximum y-value from the stored data.
| [out] | maxY | The maximum y-value will be written here if the function succeeds. |
This function returns an error if there is no data stored.
| int warptwin::InterpolateBilinear::getMinX | ( | double & | minX | ) | const |
Returns the minimum x-value from the stored data.
| [out] | minX | The minimum x-value will be written here if the function succeeds. |
This function returns an error if there is no data stored.
| int warptwin::InterpolateBilinear::getMinY | ( | double & | minX | ) | const |
Returns the minimum y-value from the stored data.
| [out] | minY | The minimum y-value will be written here if the function succeeds. |
This function returns an error if there is no data stored.
| int warptwin::InterpolateBilinear::interpolate | ( | double | x, |
| double | y, | ||
| double & | zInterpolated ) |
Performs bilinear interpolation given an (x, y) value pair.
| [in] | x | The x-value for which to interpolate. |
| [in] | y | The y-value for which to interpolate. |
| [out] | zInterpolated | The interpolated z-value will be written here if the function succeeds. |
If x or y is out of the bounds of the stored table, this function returns a non-zero error code. If there are not enough points to perform interpolation, it returns a non-zero error code as well.
| int warptwin::InterpolateBilinear::setData | ( | const std::vector< double > & | xValues, |
| const std::vector< double > & | yValues, | ||
| const std::vector< std::vector< double > > & | zValues ) |
Sets the data for the interpolator.
| xValues | A vector of x-values (must be sorted in ascending order). |
| yValues | A vector of y-values (must be sorted in ascending order). |
| zValues | A matrix of z-values whose ith row and jth col corresponds to the point x[i], y[j] |
This function replaces any previously stored data with the new x, y, and z values. It is required that xValues.size() == zValues.size() and yValues.size() == zValues[0].size(). It is alse required that xValues and yValues is sorted in ascending order. If these conditions are not met, a non-zero error code is returned.