MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ heading_vector() [2/4]

glm::vec3 MayaFlux::Kinesis::heading_vector ( const Memory::HistoryBuffer< glm::vec3 > &  history,
double  dt 
)
inlinenoexcept

Unit direction of a vec3 first difference.

Parameters
historyBuffer with capacity >= 2
dtElapsed time between samples 0 and 1
Returns
Normalized velocity, or the zero vector when speed is below 1e-6 to avoid dividing by zero on a stationary point

Definition at line 322 of file Differential.hpp.

323{
324 const glm::vec3 v = velocity(history, dt);
325 const float len = glm::length(v);
326 return (len > 1e-6F) ? (v / len) : glm::vec3(0.0F);
327}
T velocity(const Memory::HistoryBuffer< T > &history, double dt) noexcept
First difference: rate of change of position.

References velocity().

+ Here is the call graph for this function: