#include <Curve.h>
Classes | |
class | Point |
Public Types | |
enum | InterpolationType { BEZIER, BSPLINE, FLAT, HERMITE, LINEAR, SMOOTH, STEP, QUADRATIC_IN, QUADRATIC_OUT, QUADRATIC_IN_OUT, QUADRATIC_OUT_IN, CUBIC_IN, CUBIC_OUT, CUBIC_IN_OUT, CUBIC_OUT_IN, QUARTIC_IN, QUARTIC_OUT, QUARTIC_IN_OUT, QUARTIC_OUT_IN, QUINTIC_IN, QUINTIC_OUT, QUINTIC_IN_OUT, QUINTIC_OUT_IN, SINE_IN, SINE_OUT, SINE_IN_OUT, SINE_OUT_IN, EXPONENTIAL_IN, EXPONENTIAL_OUT, EXPONENTIAL_IN_OUT, EXPONENTIAL_OUT_IN, CIRCULAR_IN, CIRCULAR_OUT, CIRCULAR_IN_OUT, CIRCULAR_OUT_IN, ELASTIC_IN, ELASTIC_OUT, ELASTIC_IN_OUT, ELASTIC_OUT_IN, OVERSHOOT_IN, OVERSHOOT_OUT, OVERSHOOT_IN_OUT, OVERSHOOT_OUT_IN, BOUNCE_IN, BOUNCE_OUT, BOUNCE_IN_OUT, BOUNCE_OUT_IN } |
Public Member Functions | |
unsigned int | getPointCount () const |
unsigned int | getComponentCount () const |
float | getStartTime () const |
float | getEndTime () const |
void | setPoint (unsigned int index, float time, float *value, InterpolationType type) |
void | setPoint (unsigned int index, float time, float *value, InterpolationType type, float *inValue, float *outValue) |
void | setTangent (unsigned int index, InterpolationType type, float *inValue, float *outValue) |
float | getPointTime (unsigned int index) const |
InterpolationType | getPointInterpolation (unsigned int index) const |
void | getPointValues (unsigned int index, float *value, float *inValue, float *outValue) const |
void | evaluate (float time, float *dst) const |
void | evaluate (float time, float startTime, float endTime, float loopBlendTime, float *dst) const |
Static Public Member Functions | |
static Curve * | create (unsigned int pointCount, unsigned int componentCount) |
static float | lerp (float t, float from, float to) |
Defines an n-dimensional curve.
Types of interpolation.
Defines how the points in the curve are connected.
Note: InterpolationType::BEZIER requires control points and InterpolationType::HERMITE requires tangents.
static Curve* gameplay::Curve::create | ( | unsigned int | pointCount, |
unsigned int | componentCount | ||
) | [static] |
Creates a new curve.
pointCount | The number of points in the curve. |
componentCount | The number of float component values per key value. |
void gameplay::Curve::evaluate | ( | float | time, |
float * | dst | ||
) | const |
Evaluates the curve at the given position value.
Time should generally be specified as a value between 0.0 - 1.0, inclusive. A value outside this range can also be specified to perform an interpolation between the two end points of the curve. This can be useful for smoothly interpolating a repeat of the curve.
time | The position to evaluate the curve at. |
dst | The evaluated value of the curve at the given time. |
void gameplay::Curve::evaluate | ( | float | time, |
float | startTime, | ||
float | endTime, | ||
float | loopBlendTime, | ||
float * | dst | ||
) | const |
Evaluates the curve at the given position value (between 0.0 and 1.0 inclusive) within the specified subregion of the curve.
This method is useful for evaluating sub sections of the curve. A common use for this is when evaluating individual animation clips that are positioned within a larger animation curve. This method also allows looping to occur between the end points of curve sub regions, with optional blending/interpolation between the end points (using the loopBlendTime parameter).
Time should generally be specified as a value between 0.0 - 1.0, inclusive. A value outside this range can also be specified to perform an interpolation between the two end points of the curve. This can be useful for smoothly interpolating a repeat of the curve.
time | The position within the subregion of the curve to evaluate the curve at. A time of zero represents the start of the subregion, with a time of one representing the end of the subregion. |
startTime | Start time for the subregion (between 0.0 - 1.0). |
endTime | End time for the subregion (between 0.0 - 1.0). |
loopBlendTime | Time (in milliseconds) to blend between the end points of the curve for looping purposes when time is outside the range 0-1. A value of zero here disables curve looping. |
dst | The evaluated value of the curve at the given time. |
unsigned int gameplay::Curve::getComponentCount | ( | ) | const |
Gets the number of float component values per points.
float gameplay::Curve::getEndTime | ( | ) | const |
Returns the end time for the curve.
unsigned int gameplay::Curve::getPointCount | ( | ) | const |
Gets the number of points in the curve.
InterpolationType gameplay::Curve::getPointInterpolation | ( | unsigned int | index | ) | const |
Gets the interpolation type at the specified point
index | The index of the point. |
float gameplay::Curve::getPointTime | ( | unsigned int | index | ) | const |
Gets the time at a specified point.
index | The index of the point. |
void gameplay::Curve::getPointValues | ( | unsigned int | index, |
float * | value, | ||
float * | inValue, | ||
float * | outValue | ||
) | const |
Gets the values and in/out tangent value at a spedified point.
index | The index of the point. |
value | The value at the specified index. Ignored if NULL. |
inValue | The tangent inValue at the specified index. Ignored if NULL. |
outValue | The tangent outValue at the specified index. Ignored if NULL. |
float gameplay::Curve::getStartTime | ( | ) | const |
Returns the start time for the curve.
static float gameplay::Curve::lerp | ( | float | t, |
float | from, | ||
float | to | ||
) | [static] |
Linear interpolation function.
void gameplay::Curve::setPoint | ( | unsigned int | index, |
float | time, | ||
float * | value, | ||
InterpolationType | type | ||
) |
Sets the given point values on the curve.
index | The index of the point. |
time | The time for the key. |
value | The point to add. |
type | The curve interpolation type. |
void gameplay::Curve::setPoint | ( | unsigned int | index, |
float | time, | ||
float * | value, | ||
InterpolationType | type, | ||
float * | inValue, | ||
float * | outValue | ||
) |
Sets the given point on the curve for the specified index and the specified parameters.
index | The index of the point. |
time | The time of the point within the curve. |
value | The value of the point to copy the data from. |
type | The curve interpolation type. |
inValue | The tangent approaching the point. |
outValue | The tangent leaving the point. |
void gameplay::Curve::setTangent | ( | unsigned int | index, |
InterpolationType | type, | ||
float * | inValue, | ||
float * | outValue | ||
) |
Sets the tangents for a point on the curve specified by the index.
index | The index of the point. |
type | The interpolation type. |
type | The curve interpolation type. |
inValue | The tangent approaching the point. |
outValue | The tangent leaving the point. |