|
emilib
|
#include <movement_tracker.hpp>
Classes | |
| struct | TimePosPair |
Public Types | |
| using | value_type = T |
Public Member Functions | |
| void | clear () |
| void | add (const T &pos, double time) |
| std::vector< T > | points () const |
| bool | empty () const |
| size_t | size () const |
| double | start_time () const |
| T | start_pos () const |
| double | latest_time () const |
| T | latest_pos () const |
| T | rel () const |
| Last movement delta. | |
| double | duration () const |
| virtual T | velocity (double now) const |
| T | velocity () const |
| template<typename F > | |
| bool | is_still (F max_dist, double duration) const |
| Has all movement been within "max_dist" radius, during the last "duration" seconds? | |
| void | flush (double now) |
| Flush out oldes entries. | |
Protected Types | |
| using | TimePosList = std::deque< TimePosPair > |
Protected Member Functions | |
| bool | velocity_calc_begin (size_t &out_index, double now) const |
| From where shall we calculate velocity? Return false on "not at all". | |
Static Protected Member Functions | |
| static constexpr size_t | min_velocity_samples () |
| The minimum number of samples for there to be any velocity calculated. | |
| static constexpr double | min_velocity_time () |
| Minimum time before we have a good velocity. | |
| static constexpr double | velocity_time () |
| The time over which we calculate velocity. | |
Protected Attributes | |
| bool | _has_start = false |
| TimePosPair | _start |
| TimePosList | _list |
| double | _max_history_time = 10 |
Tracks movement and gives info about velocity. 'T' is the type of movement we track (float for scoll, Vec2 for position, ...)
|
inlinevirtual |
Return T() on fail Calculates the average velocity over the last VelocityTime() seconds.
Reimplemented in emilib::RotationTracker.
1.8.13