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

◆ total_turning() [1/2]

float MayaFlux::Kinesis::total_turning ( const Memory::HistoryBuffer< glm::vec2 > &  history,
size_t  window 
)
inlinenoexcept

Total absolute turning accumulated across a window.

Parameters
historyBuffer of positions, capacity >= window
windowNumber of samples, minimum 3
Returns
Sum of |angular_delta| between consecutive segment headings

A jitteriness measure distinct from curvature at a point: a path that wiggles back and forth accumulates large total turning even if its net curvature at any single sample is small, since positive and negative bends do not cancel here the way they would in a single derivative.

Definition at line 504 of file Differential.hpp.

505{
506 window = window < 3 ? 3 : window;
507 float total = 0.0F;
508 float prev_heading = heading(history[0] - history[1]);
509 for (size_t i = 1; i + 1 < window; ++i) {
510 const float h = heading(history[i] - history[i + 1]);
511 total += std::abs(angular_delta(h, prev_heading));
512 prev_heading = h;
513 }
514 return total;
515}
uint32_t h
Definition InkPress.cpp:28
float angular_delta(float to, float from) noexcept
Shortest signed angular difference between two headings.
float heading(const glm::vec2 &v) noexcept
Heading angle of a 2D vector.

References angular_delta(), h, and heading().

Referenced by total_turning().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: