TrinityCore
|
#include <Spline.h>
Public Member Functions | |
Spline () | |
void | append (float t, const Control &c) |
void | append (const Control &c) |
void | clear () |
int | size () const |
void | getControl (int i, float &t, Control &c) const |
Spline (const Any &any) | |
virtual Any | toAny (const std::string &myName) const |
Control | evaluate (float s) const |
Public Member Functions inherited from G3D::SplineBase | |
SplineBase () | |
virtual | ~SplineBase () |
float | getFinalInterval () const |
float | duration () const |
void | computeIndex (float s, int &i, float &u) const |
Public Attributes | |
Array< Control > | control |
Public Attributes inherited from G3D::SplineBase | |
Array< float > | time |
SplineExtrapolationMode | extrapolationMode |
float | finalInterval |
SplineInterpolationMode | interpolationMode |
Protected Member Functions | |
void | getControls (int i, float *T, Control *A, int N) const |
virtual void | ensureShortestPath (Control *A, int N) const |
virtual void | correct (Control &A) const |
virtual void | init (AnyTableReader &propertyTable) |
Protected Member Functions inherited from G3D::SplineBase | |
void | computeIndexInBounds (float s, int &i, float &u) const |
Protected Attributes | |
Control | zero |
Additional Inherited Members | |
Static Public Member Functions inherited from G3D::SplineBase | |
static Matrix4 | computeBasis () |
Smooth parameteric curve implemented using a piecewise 3rd-order Catmull-Rom spline curve. The spline is considered infinite and may either continue linearly from the specified control points or cycle through them. Control points are spaced uniformly in time at unit intervals by default, but irregular spacing may be explicitly specified.
The dimension of the spline can be set by varying the Control template parameter. For a 1D function, use Spline<float>. For a curve in the plane, Spline<Vector2>. Note that any template parameter that supports operator+(Control) and operator*(float) can be used; you can make splines out of G3D::Vector4, G3D::Matrix3, or your own classes.
To provide shortest-path interpolation, subclass G3D::Spline and override ensureShortestPath(). To provide normalization of interpolated points (e.g., projecting Quats onto the unit hypersphere) override correct().
See Real Time Rendering, 2nd edition, ch 12 for a general discussion of splines and their properties.
|
inline |
|
inlineexplicit |
Accepts a table of properties, or any valid PhysicsFrame specification for a single control
|
inline |
Appends a control point at a specific time that must be greater than that of the previous point.
|
inline |
Appends control point spaced in time based on the previous control point, or spaced at unit intervals if this is the first control point.
|
inline |
Erases all control points and times, but retains the state of cyclic and finalInterval.
|
inlineprotectedvirtual |
Normalize or otherwise adjust this interpolated Control.
Reimplemented in G3D::PhysicsFrameSpline.
|
inlineprotectedvirtual |
Mutates the array of N control points that begins at A. It is useful to override this method by one that wraps the values if they are angles or quaternions for which "shortest path" interpolation is significant.
Reimplemented in G3D::UprightSpline, and G3D::PhysicsFrameSpline.
|
inline |
Return the position at time s. The spline is defined outside of the time samples by extrapolation or cycling.
|
inline |
Returns the requested control point and time sample based on array index. If the array index is out of bounds, wraps (for a cyclic spline) or linearly extrapolates (for a non-cyclic spline), assuming time intervals follow the first or last sample recorded.
Calls correct() on the control point if it was extrapolated.
Returns 0 if there are no control points.
|
inlineprotected |
Returns a series of N control points and times, fixing boundary issues. The indices may be assumed to be treated cyclically.
|
inlineprotectedvirtual |
Does not invoke verifyDone() on the propertyTable because subclasses may have more properties
|
inline |
Number of control points
|
inlinevirtual |
Note that invoking classes can call setName on the returned value instead of passing a name in.
Reimplemented in G3D::UprightSpline, and G3D::PhysicsFrameSpline.
Array<Control> G3D::Spline< Control >::control |
Control points. Must have the same number of elements as Spline::time.
|
protected |
The additive identity control point.