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... | |
static String | GetSerializableName () |
get the name of this class for serialization purposes More... | |
template<typename TIterator > | |
static T | Interpolate (TIterator Begin, TIterator End, Real Location) |
This will interpolates data point with GetInterpolatedFromMultiple or InterpolateMath as required. More... | |
static T | InterpolateMath (T Begin, T End, Real Location) |
Get a value at a given location between exactly two others. More... | |
static void | ProtoDeSerialize (const XML::Node &OneNode) |
This does not create or change the object it deserializes, but it does verify type info. More... | |
static void | ProtoSerialize (XML::Node &CurrentRoot) |
Append a node for with enough information to deserialize to the passed node. More... | |
A simple functor for interpolating data points in a simple way.
This interpolator provides certain guarantees.
Corners can be thought of as any non-smooth change, and may not be intuitively in some interpolatable types.
Definition at line 78 of file interpolator.h.
typedef T Mezzanine::LinearInterpolator< T >::InterpolatableType |
The type this will interpolate.
Definition at line 83 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 146 of file interpolator.h.
|
inlinestatic |
get the name of this class for serialization purposes
Definition at line 244 of file interpolator.h.
|
inlinestatic |
This will interpolates data point with GetInterpolatedFromMultiple or InterpolateMath as 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 176 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 92 of file interpolator.h.
|
inlinestatic |
This does not create or change the object it deserializes, but it does verify type info.
OneNode | The node to read serialized data from. |
Definition at line 221 of file interpolator.h.
|
inlinestatic |
Append a node for with enough information to deserialize to the passed node.
CurrentRoot | A node to act as the parent for the serialized version of this one. |
Definition at line 194 of file interpolator.h.