detecting left or right rotation from an arbitrary point on a circle


    Aug 23 2010 | 2:01 am
    Hey forum.
    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.

    • Aug 23 2010 | 5:22 am
      While I was looking for a mathematical solution, I settled for a simple (and messy) conditional system.
    • Aug 23 2010 | 12:26 pm
      Thanks, an excelent solution (accum! I always forget about him)
    • Aug 23 2010 | 7:31 pm
      Yeah, my intent was to figure out a way with trig as well. Your accum patch works well enough for this particular system.
      maybe later in the week I can revisit the issue.
    • Aug 24 2010 | 3:23 am
      don't have anything to add per se. just wanted to make a comment on pizza olives' "delta" patch. there is an easier way of getting delta values, with less objects. Probably doesn't make much of a difference in terms of performance. just thought I would share: