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

◆ signed_turning()

float MayaFlux::Kinesis::signed_turning ( std::span< const glm::vec2 >  path)
inlinenoexcept

Turning accumulated along a path, with sign retained.

Parameters
pathPositions in chronological order, at least three
Returns
Sum of signed angular deltas between consecutive segment headings, positive for net counterclockwise

The signed counterpart to total_turning in Differential.hpp, which accumulates absolute values. That one measures how much a path bent in total and is blind to direction; this one measures where it ended up in heading and lets opposing bends cancel.

The pair separates cases neither resolves alone. A closed circle and a figure-eight of the same arc length accumulate similar absolute turning and very different signed turning, near one full revolution against near zero. A clockwise and a counterclockwise circle are identical under absolute turning and opposite under this.

Definition at line 98 of file PathShape.hpp.

99{
100 if (path.size() < 3)
101 return 0.0F;
102
103 float total = 0.0F;
104 float prev = heading(path[1] - path[0]);
105 for (size_t i = 2; i < path.size(); ++i) {
106 const float h = heading(path[i] - path[i - 1]);
107 total += angular_delta(h, prev);
108 prev = h;
109 }
110 return total;
111}
uint32_t h
Definition InkPress.cpp:29
uint32_t total
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, heading(), and total.

Referenced by winding_number().

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