## reavTIVision rotation direction

Oct 2, 2007 at 9:22pm

# reavTIVision rotation direction

Hi guys,

I’m having a play with reacTIVision but I can’t seem to figure out how to discern the direction of object rotation. I am not particularly interested in the angle, more whether the object is being rotated clockwise or anti clockwise.

In the main this is very easy using the change object but problems occur when the angle changes from 360 to 1 or vice versa. I’ve come up with a few very messy work arounds but I’m sure there must be a very easy way to do this that I am just not seeing.

Can anyone help?

Cheers

Andy

#33937
Oct 2, 2007 at 11:47pm

Hi

you can try with a modulo 360, and then look at the rest of the division : soustract two successive values to get the signe.
Be careful, the angle output is in radians with the reactivison max object.

g

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 175 170 40 196617 change;
#P newex 175 233 32 196617 print;
#P message 248 212 54 196617 clockwise;
#P message 175 212 71 196617 anticlockwise;
#P newex 175 191 41 196617 sel 0 1;
#P newex 175 149 27 196617 > 0;
#P newex 175 107 27 196617 t i i;
#P newex 175 128 27 196617 -;
#N vpatcher 20 74 620 474;
#P origin 0 30;
#P window setfont “Sans Serif” 9.;
#P newex 100 289 27 196617 %;
#P newex 232 106 65 196617 maximum 1.;
#P newex 42 289 27 196617 +;
#P newex 59 266 27 196617 /;
#P newex 100 191 27 196617 +;
#P newex 42 190 27 196617 – 1;
#P newex 100 165 27 196617 %;
#P newex 42 165 27 196617 /;
#P inlet 232 22 15 0;
#P inlet 42 22 15 0;
#P outlet 42 410 15 0;
#P outlet 100 410 15 0;
#P newex 215 285 27 196617 %;
#P newex 180 285 27 196617 /;
#P newex 42 71 148 196617 if \$i1<0 then \$i1 else out2 \$i1;
#P newex 253 61 75 196617 loadmess 360.;
#P connect 6 0 1 0;
#P connect 1 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 13 0;
#P connect 2 0 5 0;
#P connect 13 0 5 0;
#P connect 14 0 8 1;
#P connect 11 0 12 0;
#P connect 12 0 13 1;
#P connect 14 0 12 1;
#P connect 1 0 9 0;
#P connect 9 0 11 0;
#P connect 11 0 15 0;
#P connect 3 0 4 0;
#P connect 15 0 4 0;
#P connect 14 0 9 1;
#P connect 14 0 11 1;
#P connect 14 0 15 1;
#P connect 1 1 2 0;
#P connect 14 0 2 1;
#P connect 1 1 3 0;
#P connect 7 0 14 0;
#P connect 0 0 14 0;
#P connect 14 0 3 1;
#P pop;
#P newobj 117 86 68 196617 p divmod360;
#P number 117 65 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P connect 1 1 3 0;
#P connect 0 0 1 0;
#P connect 5 1 7 0;
#P connect 5 0 6 0;
#P connect 9 0 5 0;
#P connect 4 0 9 0;
#P connect 7 0 8 0;
#P connect 6 0 8 0;
#P connect 2 0 4 0;
#P connect 3 0 2 1;
#P connect 3 1 2 0;
#P window clipboard copycount 10;

#113689
Oct 3, 2007 at 2:22am

Hi Andy,

I don’t know that this is an improvement, but I took the approach of
treating rotation like an endless rotary encoder. movement to the left
will subtract a ‘tick’ from an accumulator, movement to the right will
add a ‘tick’. The problem I find with this patch is that it isn’t
very responsive to fast rotations – I guess I could look at the size
of the increase in angle and adjust the number of ticks counted
accordingly. Anyway, here’s the patch – hope it helps. If anyone else
has suggestions on this topics, I’d be all ears….

max v2;
#N vpatcher 700 351 1300 751;
#P inlet 173 30 15 0;
#P window setfont “Sans Serif” 9.;
#P number 324 54 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 114 214 15 0;
#P number 171 192 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 114 112 50 196617 unpack;
#P button 50 185 15 0;
#P newex 50 159 50 196617 match 0;
#P number 50 113 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 50 133 50 196617 % 2;
#P newex 113 85 97 196617 list-accum 2;
#P newex 114 240 50 196617 accum 0;
#N counter;
#X flags 0 0;
#P newobj 33 84 72 196617 counter;
#P newex 113 50 50 196617 change;
#P newex 114 158 179 196617 if \$i1 > \$i2 then -1 else 1;
#P inlet 113 30 15 0;
#P outlet 114 262 15 0;
#P fasten 3 0 4 0 118 75 38 75;
#P fasten 4 0 8 0 38 107 55 107;
#P connect 8 0 7 0;
#P connect 7 0 9 0;
#P connect 9 0 10 0;
#P fasten 14 0 4 3 83 69;
#P connect 1 0 3 0;
#P fasten 10 0 6 0 55 206 108 206 108 77 118 77;
#P connect 3 0 6 0;
#P connect 6 0 11 0;
#P connect 11 0 2 0;
#P connect 2 0 13 0;
#P connect 13 0 5 0;
#P fasten 14 0 5 0 329 232 119 232;
#P connect 5 0 0 0;
#P fasten 2 0 5 1 119 207 139 207;
#P connect 2 0 12 0;
#P connect 11 1 2 1;
#P fasten 15 0 14 0 178 49 329 49;
#P pop;

On 10/3/07, Andy Brennan wrote:
>
> Hi guys,
>
> I’m having a play with reacTIVision but I can’t seem to figure out how to discern the direction of object rotation. I am not particularly interested in the angle, more whether the object is being rotated clockwise or anti clockwise.
>
> In the main this is very easy using the change object but problems occur when the angle changes from 360 to 1 or vice versa. I’ve come up with a few very messy work arounds but I’m sure there must be a very easy way to do this that I am just not seeing.
>
> Can anyone help?
>
> Cheers
>
> Andy
>

#113690
Oct 10, 2007 at 11:59am

Andy Brennan schrieb:
> In the main this is very easy using the change object but problems
> occur when the angle changes from 360 to 1 or vice versa. I’ve come
> up with a few very messy work arounds but I’m sure there must be a
> very easy way to do this that I am just not seeing.

Just watch out the big jumps, and interpret them as the opposite:

#P window setfont “Sans Serif” 9.;
#P flonum 267 186 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 291 327 50 196617 change;
#P newex 267 163 41 196617 * 360.;
#P newex 267 258 34 196617 sel 0.;
#P message 291 415 72 196617;
#P newex 291 392 62 196617 prepend set;
#P newex 291 348 66 196617 sel 1;
#P newex 364 303 25 196617 < 0.;
#P newex 291 303 25 196617 > 0.;
#P newex 291 280 83 196617 split -180. 180.;
#P newex 267 207 31 196617 t f f;
#P newex 267 230 31 196617 – 0.;
#P user jsui 267 107 50 50 1 0 0 jsui_360dial.js;
#P message 291 370 54 196617 clockwise;
#P message 347 370 71 196617 anticlockwise;
#P connect 14 0 4 0;
#P connect 12 0 14 0;
#P connect 2 0 12 0;
#P connect 1 0 9 0;
#P fasten 0 0 9 0 352 388 296 388;
#P connect 3 0 11 0;
#P connect 11 1 5 0;
#P connect 13 0 8 0;
#P fasten 7 0 13 0 369 323 296 323;
#P connect 6 0 13 0;
#P connect 5 0 6 0;
#P connect 5 1 7 0;
#P connect 9 0 10 0;
#P connect 8 1 0 0;
#P connect 8 0 1 0;
#P connect 4 0 3 1;
#P connect 4 1 3 0;
#P window clipboard copycount 15;

Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#113691
Oct 10, 2007 at 12:55pm

Damn. So simple. Thanks for that.

Andy

#113692

You must be logged in to reply to this topic.