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

◆ straightness() [2/3]

double MayaFlux::Kinesis::straightness ( std::span< const double >  samples,
size_t  window 
)
inlinenoexcept

Monotonicity of a window, 1.0 for a straight run in one direction.

Parameters
samplesNewest-first span
windowNumber of samples, minimum 2
Returns
net_displacement / path_length, or 0 when the window is flat

A value that climbs or falls steadily scores near 1.0 regardless of how fast; one that wanders back and forth scores near 0.0.

Definition at line 861 of file Differential.hpp.

862{
863 const double len = path_length(samples, window);
864 if (len < 1e-12)
865 return 0.0;
866 return net_displacement(samples, window) / len;
867}
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
float path_length(const Memory::HistoryBuffer< glm::vec2 > &history, size_t window) noexcept
Path length accumulated across the newest window positions.
float net_displacement(const Memory::HistoryBuffer< glm::vec2 > &history, size_t window) noexcept
Net displacement across the newest window positions.

References net_displacement(), path_length(), and window.

+ Here is the call graph for this function: