[PD] cartopol

Shahrokh Yadegari syadegar at man104-1.ucsd.edu
Mon Feb 4 08:50:37 CET 2002


Hi,

The syntax of expr is very close to that of the C language. The upchar '^'
for expr does not mean to the power of, it is the 'exclusive or' operator.

You can use the following expressions to translate from rectangular
to polar coordinates:

x: $f1
y: $f2
magnitude: expr sqrt($f1*$f1+$f2*$f2)
phase:     expr atan2($f2, $f1)
(Replace $f to $v, if you are using expr~ for signals)

atan2() works better than atan() because if you use atan($f2/$f1) you have
to do some checking for the case of $f1==0 and figure out the correct
phase based on the signs of $f1 and $f2. Also make sure that the y value
($f2) is passed to the expr object prior to the x value ($f1), otherwise
you will not get the correct result.

Hope this helps,
Shahrokh.

On Sun, 3 Feb 2002, [ISO-8859-1] _-¯-_ wrote:

>
> hu
>
> does anyone have a cartesian to polar conversion object, preferably
> compatible to max "cartopol"?
>
> also i m askingmyself wether cartopol is the same as rectopol.
>
> i tried it with
>
> expr ($f1 ^ 2 + $f2 ^ 2) ^ .5
>
> for radius and
>
> expr tan ^ -1 ($f2/$f1) (this doesnt really work like this in expr)
>
> for the angle, according to some cheesy equation i got off the net but
> it sort of gives different results from the max version.
>
> x.j
>
> --
> >         < Þ V · o r g
>
>




More information about the Pd-list mailing list