I'm building out a TUIO interface in which a fiducial is going to act like a binary knob. If you turn it to the right more than 30 degrees, an action happens. If you turn it to the left more than 30 degrees, a different action happens.
There is nothing on the physical object to indicate which end is "up", the zero point. he TUIO software give me the fiducial's rotation in values from 1-360. By taking the initial angle and subtracting/adding 30, I can easily find if it has passed the threshold for the action, unless the area of change happens in the crossover between 1 and 360.
How can my mathematically challenged self get around this? All I have so far is a simple utility that will record every 30 degrees and set a new reference point. I'd like a way to wrap the values so i can tell direction.
Attached is a patch that replicates 1) what I have so far, and 2) the setup with a dial and randomly generated value. Thanks for your help.