TrinityCore
|
#include <Spline.h>
Public Member Functions | |
SplineBase () | |
virtual | ~SplineBase () |
float | getFinalInterval () const |
float | duration () const |
void | computeIndex (float s, int &i, float &u) const |
Static Public Member Functions | |
static Matrix4 | computeBasis () |
Public Attributes | |
Array< float > | time |
SplineExtrapolationMode | extrapolationMode |
float | finalInterval |
SplineInterpolationMode | interpolationMode |
Protected Member Functions | |
void | computeIndexInBounds (float s, int &i, float &u) const |
Common implementation code for all G3D::Spline template parameters
|
inline |
|
static |
Computes the derivative spline basis from the control point version.
void G3D::SplineBase::computeIndex | ( | float | s, |
int & | i, | ||
float & | u | ||
) | const |
Given a time s, finds i and 0 <= u < 1 such that s = time[i] * u + time[i + 1] * (1 - u). Note that i may be outside the bounds of the time and control arrays; use getControl to handle wraparound and extrapolation issues.
This function takes expected O(1) time for control points with uniform time sampled control points or for uniformly distributed random time samples, but may take O( log time.size() ) time in the worst case.
Called from evaluate().
|
protected |
Assumes that t0 <= s < tn. called by computeIndex.
float G3D::SplineBase::duration | ( | ) | const |
Returns the amount of time covered by this spline in one period. For a cyclic spline, this contains the final interval.
float G3D::SplineBase::getFinalInterval | ( | ) | const |
See specification for Spline::finalInterval; this handles the non-positive case. Returns 0 if not cyclic.
SplineExtrapolationMode G3D::SplineBase::extrapolationMode |
If CYCLIC, then the control points will be assumed to wrap around. If LINEAR, then the tangents at the ends of the spline point to the final control points. If CONSTANT, the end control points will be treated as multiple contol points (so the value remains constant at the ends)
float G3D::SplineBase::finalInterval |
For a cyclic spline, this is the time elapsed between the last control point and the first. If less than or equal to zero this is assumed to be:
(time[0] - time[1] + . time[time.size() - 1] - time[time.size() - 2]) / 2.
SplineInterpolationMode G3D::SplineBase::interpolationMode |
Array<float> G3D::SplineBase::time |
Times at which control points occur. Must have the same number of elements as Spline::control.