[PD] expression with arctn

IOhannes m zmölnig zmoelnig at iem.at
Mon Feb 3 13:57:07 CET 2020


On 2/3/20 10:28 AM, Csaba Láng wrote:
> Back to the difference of Iohannes' suggestions, looks like [expr atan...]
> gives results only from -90 to 90 degrees, [atan2] gives from -180 to 180.

yes, quite obviously.
this is why atan2 was introduced (in various programming languages; Pd
is only following other implementations, like C).

the problem being that you cannot distinguish -1/-1 from 1/1 (both will
yield the same result; however, for the atan the signs of the numerator
& denominator determine the quadrant of the output.

> And the atan2 is 90 degree rotated: atan2 results 0 degree on (1;0) while
> the expression gives 0 degrees on (0;1) and (0;-1).

dunno what you mean.

[atan2] and [expr atan2($f1,$f2)] give exactly the same results.

(of course if you use [expr atan2($f2,$f1)] you reverse the arguments;
but that's what you ask for...)


gfmdsar
IOhannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20200203/934a0e61/attachment.sig>


More information about the Pd-list mailing list