overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Classes | Public Types | Public Member Functions | Static Public Member Functions
gameplay::Curve Class Reference

#include <Curve.h>

Inheritance diagram for gameplay::Curve:
gameplay::Ref

List of all members.

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 Curvecreate (unsigned int pointCount, unsigned int componentCount)
static float lerp (float t, float from, float to)

Detailed Description

Defines an n-dimensional curve.


Member Enumeration Documentation

Types of interpolation.

Defines how the points in the curve are connected.

Note: InterpolationType::BEZIER requires control points and InterpolationType::HERMITE requires tangents.

Enumerator:
BEZIER 

Bezier Interpolation.

Requires that two control points are set for each segment.

BSPLINE 

B-Spline Interpolation.

Uses the points as control points, and the curve is guaranteed to only pass through the first and last point.

FLAT 

Flat Interpolation.

A form of Hermite interpolation that generates flat tangents for you. The tangents have a value equal to 0.

HERMITE 

Hermite Interpolation.

Requires that two tangents for each segment.

LINEAR 

Linear Interpolation.

SMOOTH 

Smooth Interpolation.

A form of Hermite interpolation that generates tangents for each segment based on the points prior to and after the segment.

STEP 

Discrete Interpolation.

QUADRATIC_IN 

Quadratic-In Interpolation.

QUADRATIC_OUT 

Quadratic-Out Interpolation.

QUADRATIC_IN_OUT 

Quadratic-In-Out Interpolation.

QUADRATIC_OUT_IN 

Quadratic-Out-In Interpolation.

CUBIC_IN 

Cubic-In Interpolation.

CUBIC_OUT 

Cubic-Out Interpolation.

CUBIC_IN_OUT 

Cubic-In-Out Interpolation.

CUBIC_OUT_IN 

Cubic-Out-In Interpolation.

QUARTIC_IN 

Quartic-In Interpolation.

QUARTIC_OUT 

Quartic-Out Interpolation.

QUARTIC_IN_OUT 

Quartic-In-Out Interpolation.

QUARTIC_OUT_IN 

Quartic-Out-In Interpolation.

QUINTIC_IN 

Quintic-In Interpolation.

QUINTIC_OUT 

Quintic-Out Interpolation.

QUINTIC_IN_OUT 

Quintic-In-Out Interpolation.

QUINTIC_OUT_IN 

Quintic-Out-In Interpolation.

SINE_IN 

Sine-In Interpolation.

SINE_OUT 

Sine-Out Interpolation.

SINE_IN_OUT 

Sine-In-Out Interpolation.

SINE_OUT_IN 

Sine-Out-In Interpolation.

EXPONENTIAL_IN 

Exponential-In Interpolation.

EXPONENTIAL_OUT 

Exponential-Out Interpolation.

EXPONENTIAL_IN_OUT 

Exponential-In-Out Interpolation.

EXPONENTIAL_OUT_IN 

Exponential-Out-In Interpolation.

CIRCULAR_IN 

Circular-In Interpolation.

CIRCULAR_OUT 

Circular-Out Interpolation.

CIRCULAR_IN_OUT 

Circular-In-Out Interpolation.

CIRCULAR_OUT_IN 

Circular-Out-In Interpolation.

ELASTIC_IN 

Elastic-In Interpolation.

ELASTIC_OUT 

Elastic-Out Interpolation.

ELASTIC_IN_OUT 

Elastic-In-Out Interpolation.

ELASTIC_OUT_IN 

Elastic-Out-In Interpolation.

OVERSHOOT_IN 

Overshoot-In Interpolation.

OVERSHOOT_OUT 

Overshoot-Out Interpolation.

OVERSHOOT_IN_OUT 

Overshoot-In-Out Interpolation.

OVERSHOOT_OUT_IN 

Overshoot-Out-In Interpolation.

BOUNCE_IN 

Bounce-In Interpolation.

BOUNCE_OUT 

Bounce-Out Interpolation.

BOUNCE_IN_OUT 

Bounce-In-Out Interpolation.

BOUNCE_OUT_IN 

Bounce-Out-In Interpolation.


Member Function Documentation

static Curve* gameplay::Curve::create ( unsigned int  pointCount,
unsigned int  componentCount 
) [static]

Creates a new curve.

Parameters:
pointCountThe number of points in the curve.
componentCountThe 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.

Parameters:
timeThe position to evaluate the curve at.
dstThe 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.

Parameters:
timeThe 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.
startTimeStart time for the subregion (between 0.0 - 1.0).
endTimeEnd time for the subregion (between 0.0 - 1.0).
loopBlendTimeTime (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.
dstThe evaluated value of the curve at the given time.
unsigned int gameplay::Curve::getComponentCount ( ) const

Gets the number of float component values per points.

Returns:
The number of float component values per point.
float gameplay::Curve::getEndTime ( ) const

Returns the end time for the curve.

Returns:
The curve's end time.
unsigned int gameplay::Curve::getPointCount ( ) const

Gets the number of points in the curve.

Returns:
The number of points in the curve.

Gets the interpolation type at the specified point

Parameters:
indexThe index of the point.
Returns:
The interpolation type at the specified index.
float gameplay::Curve::getPointTime ( unsigned int  index) const

Gets the time at a specified point.

Parameters:
indexThe index of the point.
Returns:
The time for a key 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.

Parameters:
indexThe index of the point.
valueThe value at the specified index. Ignored if NULL.
inValueThe tangent inValue at the specified index. Ignored if NULL.
outValueThe tangent outValue at the specified index. Ignored if NULL.

Returns the start time for the curve.

Returns:
The curve's start time.
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.

Parameters:
indexThe index of the point.
timeThe time for the key.
valueThe point to add.
typeThe 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.

Parameters:
indexThe index of the point.
timeThe time of the point within the curve.
valueThe value of the point to copy the data from.
typeThe curve interpolation type.
inValueThe tangent approaching the point.
outValueThe 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.

Parameters:
indexThe index of the point.
typeThe interpolation type.
typeThe curve interpolation type.
inValueThe tangent approaching the point.
outValueThe tangent leaving the point.
 All Classes Functions Variables Typedefs Enumerations Enumerator