58 void update(
float time,
bool ignoreEmptyTracks =
false);
74 std::map<TrackID, VariantTrack> tracks;
82 template <
typename ValueT>
86 return [&v](
VariantValue value) { v = std::get<ValueT>(value); };
std::function< void(VariantValue)> UpdateFunc
This class is used to update entities based on trajectory defined by keyframes.
void update(float time, bool ignoreEmptyTracks=false)
Update all tracks for the given time.
VariantTrack & operator[](const TrackID &id)
Get the track with the given ID.
VariantTrack & addTrack(const TrackID &id)
Add track with the given ID (and no update function).
void addKeyframe(const TrackID &id, const VariantKeyframe &keyframe)
Add a keyframe to the specified track.
friend std::ostream & operator<<(std::ostream &os, const Trajectory &trajectory)
void clear()
Clear the trajectory of all tracks.
Quaternion< float, 0 > Quaternionf
VariantTrack::UpdateFunc toUpdateFunc(std::function< void(float)> func)
Wrap the function in a Track::UpdateFunc.
std::variant< float, Eigen::MatrixXf, Eigen::Quaternionf > VariantValue
Variant for trajectory values.
std::ostream & operator<<(std::ostream &os, const Track< ValueT > &track)
VariantTrack::UpdateFunc updateValue(ValueT &v)
Get an update function for value assignments.
Keyframe< VariantValue > VariantKeyframe
A keyframe with of type TValue.
Track< VariantValue > VariantTrack
A track with value type TValue.
std::string TrackID
ID of tracks.