A simple functor for interpolating data points in a simple way. More...
#include <interpolator.h>
Public Types | |
typedef T | InterpolatableType |
The type this will interpolate. More... | |
typedef std::vector < InterpolatableType > | Storage |
The storage to use with thison tracks. | |
Static Public Member Functions | |
template<typename TIterator > | |
static T | GetInterpolatedFromMultiple (TIterator Begin, TIterator End, Real Location) |
Handles Interpolation of multiple points. More... | |
template<typename TIterator > | |
static T | Interpolate (TIterator Begin, TIterator End, Real Location) |
This will interpolates data points with GetInterpolatedFromMultiple or InterpolateMath a required. More... | |
static T | InterpolateMath (T Begin, T End, Real Location) |
Get a value at a given location between exactly two others. More... | |
A simple functor for interpolating data points in a simple way.
This interpolator provides certain guarantees.
Definition at line 73 of file interpolator.h.
typedef T Mezzanine::LinearInterpolator< T >::InterpolatableType |
The type this will interpolate.
Definition at line 78 of file interpolator.h.
|
inlinestatic |
Handles Interpolation of multiple points.
This will treat each data point as if it were equidistant from its neighbors and find the datasegment the desired point resides in. Then it will return a data point partway through that data segment. For example if you have three Vector2's defining two data segments as follows:
0,0 - 1,1 - 2,0
Requesting the following locations would return the following data points:
0.0 = 0,0
0.5 = 1,1
1.0 = 2,0
0.25 = 0.5,0.5
0.75 = 1.5,0.5
Any floating point location between 0 and 1 could be requested following this pattern.
Should the data segments not actually be equal in size that they will each still be treated as an equal length when calcuting size. For example if you have 2 data segments like the previous example, then .25 will be halfway through the first segment and .75 will be halfwy through the second. If you are interpolating a series of points through segment like these the larger data segment will be traversed faster. For example consider the following Real value values as data points:
-5, 0, 100 Requesting the following locations would return the following data points:
0.0 = -5
0.5 = 0
1.0 = 100
0.25 = -2.5
0.75 = 50
0.0 = -5
0.1 = -4
0.2 = -3
0.3 = -2
0.4 = -1
0.5 = 0
0.6 = 20
0.7 = 40
0.8 = 60
0.9 = 80
1.0 = 100
Note how even though the location increase by only 0.1 each step the resulting interpolated data point move relative to the length of the segment.
Begin | An iterator at the beginning of a rande of data point |
End | An iterator one past the end of the data range to interpolate. |
Location | A value between 0.0 and 1.0 that represents |
Definition at line 141 of file interpolator.h.
|
inlinestatic |
This will interpolates data points with GetInterpolatedFromMultiple or InterpolateMath a required.
read about GetInterpolatedFromMultiple or InterpolateMath to see what kinds of results this can produce.
Begin | An iterator at the beginning of a range of data point |
End | An iterator one past the end of the data range to interpolate. |
Location | A value between 0.0 and 1.0 that represents |
Definition at line 170 of file interpolator.h.
|
inlinestatic |
Get a value at a given location between exactly two others.
Begin | The data point at one end of line segment |
End | The data point at the other end of line segment |
Location | A value between 0.0 and 1.0 indicate what point on the line segment defined by Begin and End you want. |
Definition at line 87 of file interpolator.h.