On 01/12/2015 07:54 AM, Peter P. wrote: > Hi list, > > I am trying to calculate the change of angles I do get from a sensor as > degrees between -180° and 180 by subtracting subsequent values. > > As the jump from -180 to 180 would cause a jump here,
why? -180 and +180 are equivalent. the only problem you might have is, if you interpolating between say -179 and +179 (which might go through 0 rather than 180) what i usually do in such cases is to check whether the difference is >180° and if so, apply wrapping, so that i always interpolate on the shortest path. see attached abstraction gfdsar IOhannes
#N canvas 499 364 860 394 10; #X obj 147 6 inlet deg; #X obj 201 361 outlet deg; #X obj 201 100 -; #X msg 147 50 0; #X obj 147 28 route bang float; #X obj 201 160 + 180; #X obj 201 256 - 180; #X obj 201 278 +; #X floatatom 201 122 5 0 0 0 - - -, f 5; #X obj 201 320 t f f; #X obj 264 326 t f f; #X obj 201 184 / 360; #X obj 201 206 wrap; #X obj 201 228 * 360; #X text 383 60 "bang" resets the unwrapper.; #X connect 0 0 4 0; #X connect 2 0 8 0; #X connect 3 0 10 0; #X connect 4 0 3 0; #X connect 4 1 2 0; #X connect 5 0 11 0; #X connect 6 0 7 0; #X connect 7 0 9 0; #X connect 8 0 5 0; #X connect 9 0 1 0; #X connect 9 1 10 0; #X connect 10 0 7 1; #X connect 10 1 2 1; #X connect 11 0 12 0; #X connect 12 0 13 0; #X connect 13 0 6 0;
signature.asc
Description: OpenPGP digital signature
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
