Spinning Topp Logo BlackTopp Studios
inc
Public Types | Static Public Member Functions | List of all members
Mezzanine::LinearInterpolator< T > Class Template Reference

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< InterpolatableTypeStorage
 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...
 

Detailed Description

template<typename T>
class Mezzanine::LinearInterpolator< T >

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.

Member Typedef Documentation

template<typename T>
typedef T Mezzanine::LinearInterpolator< T >::InterpolatableType

The type this will interpolate.

Note
All Interpolators need to declare an InterpolatableType

Definition at line 83 of file interpolator.h.

Member Function Documentation

template<typename T>
template<typename TIterator >
static T Mezzanine::LinearInterpolator< T >::GetInterpolatedFromMultiple ( TIterator  Begin,
TIterator  End,
Real  Location 
)
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.

Parameters
BeginAn iterator at the beginning of a rande of data point
EndAn iterator one past the end of the data range to interpolate.
LocationA value between 0.0 and 1.0 that represents
Returns
A T at a location along the data segments defined by Begin and End.

Definition at line 146 of file interpolator.h.

template<typename T>
static String Mezzanine::LinearInterpolator< T >::GetSerializableName ( )
inlinestatic

get the name of this class for serialization purposes

Returns
A String containing "BezierInterpolator"

Definition at line 244 of file interpolator.h.

template<typename T>
template<typename TIterator >
static T Mezzanine::LinearInterpolator< T >::Interpolate ( TIterator  Begin,
TIterator  End,
Real  Location 
)
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.

Parameters
BeginAn iterator at the beginning of a range of data point
EndAn iterator one past the end of the data range to interpolate.
LocationA value between 0.0 and 1.0 that represents
Returns
A T at a location along the data segments defined by Begin and End.

Definition at line 176 of file interpolator.h.

template<typename T>
static T Mezzanine::LinearInterpolator< T >::InterpolateMath ( Begin,
End,
Real  Location 
)
inlinestatic

Get a value at a given location between exactly two others.

Parameters
BeginThe data point at one end of line segment
EndThe data point at the other end of line segment
LocationA value between 0.0 and 1.0 indicate what point on the line segment defined by Begin and End you want.
Returns
A Value equal to Begin if 0.0 is passed, equal to End if 1.0 is passed equal to a point exactly in the middle if 0.5 is passed.

Definition at line 92 of file interpolator.h.

template<typename T>
static void Mezzanine::LinearInterpolator< T >::ProtoDeSerialize ( const XML::Node OneNode)
inlinestatic

This does not create or change the object it deserializes, but it does verify type info.

Parameters
OneNodeThe node to read serialized data from.

Definition at line 221 of file interpolator.h.

template<typename T>
static void Mezzanine::LinearInterpolator< T >::ProtoSerialize ( XML::Node CurrentRoot)
inlinestatic

Append a node for with enough information to deserialize to the passed node.

Note
Very little data is actually serialized, most of it is type information that is not easily deserialized.
Parameters
CurrentRootA node to act as the parent for the serialized version of this one.

Definition at line 194 of file interpolator.h.


The documentation for this class was generated from the following file: