Support Forum G3D Web Page |
A subclass of Spline that keeps the rotation field of a PhysicsFrame normalized and rotating the short direction.
More...
Inherits G3D::Spline< PhysicsFrame >.
Public Member Functions | |
PhysicsFrameSpline () | |
PhysicsFrameSpline (const Any &any) | |
Accepts a table of properties, or any valid PhysicsFrame specification for a single control. More... | |
void | append (float t, const PhysicsFrame &c) |
Appends a control point at a specific time that must be greater than that of the previous point. More... | |
void | append (const PhysicsFrame &c) |
Appends control point spaced in time based on the previous control point, or spaced at unit intervals if this is the first control point. More... | |
void | clear () |
Erases all control points and times, but retains the state of cyclic and finalInterval. More... | |
void | 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). More... | |
virtual void | correct (PhysicsFrame &frame) const override |
Normalize or otherwise adjust this interpolated Control. More... | |
float | duration () const |
Returns the amount of time covered by this spline in one period. More... | |
virtual void | ensureShortestPath (PhysicsFrame *A, int N) const override |
Mutates the array of N control points that begins at A. More... | |
PhysicsFrame | evaluate (float s) const |
Return the position at time s. More... | |
void | getControl (int i, float &t, PhysicsFrame &c) const |
Returns the requested control point and time sample based on array index. More... | |
float | getFinalInterval () const |
See specification for Spline::finalInterval; this handles the non-positive case. More... | |
size_t | hashCode () const |
bool | operator!= (const PhysicsFrameSpline &a) const |
bool | operator== (const PhysicsFrameSpline &a) const |
bool | operator== (const Spline< PhysicsFrame > &other) const |
void | scaleControlPoints (float scaleFactor) |
Mutates all underlying PhysicsFrames by scaling their translation by. More... | |
int | size () const |
Number of control points. More... | |
virtual Any | toAny (const String &myName) const override |
Note that invoking classes can call setName on the returned value instead of passing a name in. More... | |
Any | toAny () const |
Static Public Member Functions | |
static Matrix4 | computeBasis () |
Computes the derivative spline basis from the control point version. More... | |
Public Attributes | |
Array< PhysicsFrame > | control |
Control points. More... | |
SplineExtrapolationMode | extrapolationMode |
If SplineInterpolationMode::CYCLIC, then the control points will be assumed to wrap around. More... | |
float | finalInterval |
For a cyclic spline, this is the time elapsed between the last control point and the first. More... | |
SplineInterpolationMode | interpolationMode |
Array< float > | time |
Times at which control points occur. More... | |
Protected Member Functions | |
void | computeIndexInBounds (float s, int &i, float &u) const |
Assumes that t0 <= s < tn. More... | |
void | getControls (int i, float *T, PhysicsFrame *A, int N) const |
Returns a series of N control points and times, fixing boundary issues. More... | |
virtual void | init (AnyTableReader &propertyTable) |
Does not invoke verifyDone() on the propertyTable because subclasses may have more properties. More... | |
Protected Attributes | |
PhysicsFrame | zero |
The additive identity control point. More... | |
A subclass of Spline that keeps the rotation field of a PhysicsFrame normalized and rotating the short direction.
G3D::PhysicsFrameSpline::PhysicsFrameSpline | ( | ) |
G3D::PhysicsFrameSpline::PhysicsFrameSpline | ( | const Any & | any | ) |
Accepts a table of properties, or any valid PhysicsFrame specification for a single control.
|
inlineinherited |
Appends a control point at a specific time that must be greater than that of the previous point.
|
inlineinherited |
Appends control point spaced in time based on the previous control point, or spaced at unit intervals if this is the first control point.
|
inlineinherited |
Erases all control points and times, but retains the state of cyclic and finalInterval.
|
staticinherited |
Computes the derivative spline basis from the control point version.
Referenced by G3D::Spline< UprightFrame >::evaluate().
|
inherited |
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().
Referenced by G3D::Spline< UprightFrame >::evaluate().
|
protectedinherited |
Assumes that t0 <= s < tn.
called by computeIndex.
|
overridevirtual |
Normalize or otherwise adjust this interpolated Control.
Reimplemented from G3D::Spline< PhysicsFrame >.
|
inherited |
Returns the amount of time covered by this spline in one period.
For a cyclic spline, this contains the final interval.
Referenced by G3D::Spline< UprightFrame >::getControl().
|
overridevirtual |
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 from G3D::Spline< PhysicsFrame >.
|
inlineinherited |
Return the position at time s.
The spline is defined outside of the time samples by extrapolation or cycling.
|
inlineinherited |
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.
|
inlineprotectedinherited |
Returns a series of N control points and times, fixing boundary issues.
The indices may be assumed to be treated cyclically.
|
inherited |
See specification for Spline::finalInterval; this handles the non-positive case.
Returns 0 if not cyclic.
|
inlineinherited |
|
inlineprotectedvirtualinherited |
Does not invoke verifyDone() on the propertyTable because subclasses may have more properties.
|
inline |
bool G3D::PhysicsFrameSpline::operator== | ( | const PhysicsFrameSpline & | a | ) | const |
|
inlineinherited |
void G3D::PhysicsFrameSpline::scaleControlPoints | ( | float | scaleFactor | ) |
Mutates all underlying PhysicsFrames by scaling their translation by.
scaleFactor |
|
inlineinherited |
Number of control points.
Note that invoking classes can call setName on the returned value instead of passing a name in.
Reimplemented from G3D::Spline< PhysicsFrame >.
|
inline |
|
inherited |
Control points.
Must have the same number of elements as Spline::time.
|
inherited |
If SplineInterpolationMode::CYCLIC, then the control points will be assumed to wrap around.
If SplineInterpolationMode::LINEAR, then the tangents at the ends of the spline point to the final control points. If SplineInterpolationMode::CLAMP, the end control points will be treated as multiple contol points (so the value remains constant at the ends)
Referenced by G3D::UprightSplineManipulator::extrapolationMode(), G3D::Spline< UprightFrame >::getControl(), G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), G3D::UprightSplineManipulator::setExtrapolationMode(), and G3D::Spline< UprightFrame >::toAny().
|
inherited |
For a cyclic spline, this is the time elapsed between the last control point and the first.
If less than zero this is assumed to be:
(time[0] - time[1] + . time[time.size() - 1] - time[time.size() - 2]) / 2.
Referenced by G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), and G3D::Spline< UprightFrame >::toAny().
|
inherited |
|
inherited |
Times at which control points occur.
Must have the same number of elements as Spline::control.
Referenced by G3D::Spline< UprightFrame >::append(), G3D::Spline< UprightFrame >::clear(), G3D::Spline< UprightFrame >::evaluate(), G3D::Spline< UprightFrame >::getControl(), G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), G3D::Spline< UprightFrame >::size(), G3D::Spline< UprightFrame >::Spline(), and G3D::Spline< UprightFrame >::toAny().
|
protectedinherited |
The additive identity control point.