Can someone explain in pseudo code or the math how this might work. It's called Unroll Rotations:

"Compensates for gimbal locking effects by unrolling rotations. Unroll Rotations is designed to clean motion capture data that contains

large rotations which cause flipping or shaking in animations."

Basically, what's given, is 3 rotation curves (x,y,z) expressed in Euler angles. These curves are initially locked to -180 to 180 degrees. After unrolling, this limitation is removed.

What I don't understand about this is, why do they focus on the Y curve? Aren't these curves unrolled independently of each other? If not, then how does unrolling one curve affect the other? I just don't understand the "unrolling" algorithm used here.