|
A track represents the timeline of a single value, identified by a track ID. More...
#include <RobotAPI/libraries/SimpleTrajectory/Track.h>
Classes | |
struct | KeyframeProxy |
A proxy allowing for adding keyframes by: track[time] = value; More... | |
Public Types | |
using | UpdateFunc = std::function< void(ValueT)> |
The update function type. More... | |
Public Member Functions | |
void | addKeyframe (const Keyframe< ValueT > &keyframe) |
Add a keyframe to this track. More... | |
void | addKeyframe (float time, const ValueT &value) |
Add a keyframe to this track. More... | |
ValueT | at (float time) const |
Get the interpolated value at the given time. More... | |
void | clear () |
Clear the track of all keyframes. More... | |
bool | empty () const |
Indicate whether this track does not contain any keyframes. More... | |
KeyframeProxy | operator[] (float time) |
Add a keyframe by assignment: track[time] = value; More... | |
Track (const TrackID &id) | |
Construct a track with given ID (and no update function). More... | |
Track (const TrackID &id, UpdateFunc updateFunc) | |
Construct a track with given ID and update function. More... | |
void | update (float time, bool ignoreIfEmpty=false) |
Call the update function with the interpolated value at the given time. More... | |
Friends | |
template<typename V > | |
std::ostream & | operator<< (std::ostream &os, const Track< V > &track) |
A track represents the timeline of a single value, identified by a track ID.
A track is comprised of a sequence of keyframes and used to call a single update function.
using UpdateFunc = std::function<void(ValueT)> |
|
inline |
void addKeyframe | ( | const Keyframe< ValueT > & | keyframe | ) |
Add a keyframe to this track.
void addKeyframe | ( | float | time, |
const ValueT & | value | ||
) |
Add a keyframe to this track.
V at | ( | float | time | ) | const |
bool empty |
auto operator[] | ( | float | time | ) |
void update | ( | float | time, |
bool | ignoreIfEmpty = false |
||
) |
Call the update function with the interpolated value at the given time.
ignoreIfEmpty | If true and the track is empty, the method does nothing. |
<tt>error::EmptyTrack</tt> | If the track is empty and ignoreIfEmpty is false. |
Definition at line 235 of file Track.h.
|
friend |