[PD] relative angle from sensor

IOhannes m zmölnig zmoelnig at iem.at
Mon Jan 12 12:27:11 CET 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unwrap.pd
Type: text/x-puredata
Size: 735 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150112/f978aba2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20150112/f978aba2/attachment.sig>


More information about the Pd-list mailing list