I have a finite series of line segments, each continuous from the previous one. I want to quantify how "straight" or "zig-zaggy" the run of line segments is.
My idea is the following:
1) Rotate all segments such that the first point of the first segment and the last point of the last segment are vertical with one another (
ΔX = 0,
ΔY > 0).
2) Walk each segment and separately sum the absolute value of both
Δy for each segment. Call these
For a perfectly straight line,
absDx = ΔX = 0 and
absDy = ΔY.
For a series that deviates from straight, either
absDy will be greater than 0. How much they're greater than 0 defines how zig-zaggy the lines are.
I am considering scaling the values based on
ΔY such that a large
ΔY requires larger
I have found other recommendations for quantifying straightness that fail to account for the idea that the line segments may double-back on themselves, or may not be of equal length and spacing.
My worry is that by simply summing values directly, I may be introducing bias in unintended ways.
 This represents gesture data captured from a touch screen.