|
This class is used to update entities based on trajectory defined by keyframes. More...
#include <RobotAPI/libraries/SimpleTrajectory/Trajectory.h>
Public Member Functions | |
void | addKeyframe (const TrackID &id, const VariantKeyframe &keyframe) |
Add a keyframe to the specified track. More... | |
void | addKeyframe (const TrackID &id, float time, const VariantValue &value) |
Add a keyframe to the specified track. More... | |
VariantTrack & | addTrack (const TrackID &id) |
Add track with the given ID (and no update function). More... | |
VariantTrack & | addTrack (const TrackID &id, const VariantTrack::UpdateFunc &updateFunc) |
Add track with the given ID and update function. More... | |
void | clear () |
Clear the trajectory of all tracks. More... | |
VariantTrack & | operator[] (const TrackID &id) |
Get the track with the given ID. More... | |
const VariantTrack & | operator[] (const TrackID &id) const |
Get the track with the given ID. More... | |
Trajectory () | |
Constructor. More... | |
void | update (float time, bool ignoreEmptyTracks=false) |
Update all tracks for the given time. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Trajectory &trajectory) |
This class is used to update entities based on trajectory defined by keyframes.
A Trajectory is a collection of tracks, where each track represents a timeline of a single value. A track is composed of keyframes, where each keyframe represents a value at a specific time on the timeline.
Definition at line 21 of file Trajectory.h.
Trajectory | ( | ) |
Constructor.
Definition at line 7 of file Trajectory.cpp.
void addKeyframe | ( | const TrackID & | id, |
const VariantKeyframe & | keyframe | ||
) |
Add a keyframe to the specified track.
<tt>error::NoTrackWithID</tt> | if there is not track with the given ID |
Definition at line 25 of file Trajectory.cpp.
void addKeyframe | ( | const TrackID & | id, |
float | time, | ||
const VariantValue & | value | ||
) |
Add a keyframe to the specified track.
<tt>error::NoTrackWithID</tt> | if there is not track with the given ID |
Definition at line 30 of file Trajectory.cpp.
VariantTrack & addTrack | ( | const TrackID & | id | ) |
Add track with the given ID (and no update function).
If there is already a track with the given ID, it is overwritten.
Definition at line 15 of file Trajectory.cpp.
VariantTrack & addTrack | ( | const TrackID & | id, |
const VariantTrack::UpdateFunc & | updateFunc | ||
) |
Add track with the given ID and update function.
If there is already a track with the given ID, it is overwritten.
Definition at line 20 of file Trajectory.cpp.
void clear | ( | ) |
Clear the trajectory of all tracks.
Definition at line 10 of file Trajectory.cpp.
VariantTrack & operator[] | ( | const TrackID & | id | ) |
Get the track with the given ID.
<tt>error::NoTrackWithID</tt> | if there is not track with the given ID |
Definition at line 43 of file Trajectory.cpp.
const VariantTrack & operator[] | ( | const TrackID & | id | ) | const |
Get the track with the given ID.
<tt>error::NoTrackWithID</tt> | if there is not track with the given ID |
Definition at line 55 of file Trajectory.cpp.
void update | ( | float | time, |
bool | ignoreEmptyTracks = false |
||
) |
Update all tracks for the given time.
ignoreEmptyTracks | If true, empty tracks are ignored. |
<tt>error::EmptyTrack</tt> | If ignoreEmptyTracks is false and a track is empty. |
Definition at line 35 of file Trajectory.cpp.
|
friend |