Forum

How does "polar" work?

Hi,

I know this is a very lame question but I can’t seem to figure out how “polar” works for a 2D vector.

Since it’s a 2D vector I leave Z as 1 and just use the other two. I would expect that one of the two output angles would go from -0.5 to 0.5 but actually it only goes from 0 to 0.25 and then back to 0 and then to -0.25 and then back to 0. This means that somehow both angles are correlated.

How do I get a simple 2D cartesian2polar conversion like you can easily get in MAX? What am I doing wrong?

Thanks,
Nuno

you have to set z to 0, otherwise your vector will have the wrong lenght. also have a look at the category Complex, there should be all you need to work in 2D, complex numbers are just 2D vectors, Arg (Complex) for example is the angle and Abs (Complex) the length. see an example in the attached patch:

Polar2D.v4p (6.3 kB)

Point2Vec and Vec2Point do the 2d case is a quite straightforward way

if you still want to use the polar node i would suggest to use x and z and leave y at 0.

Hi,

Thank you for your answers. You were most helpful.

tonfilm: actually if you try to set x=-1 and y=0 you’ll find out that Polar and Arg+Abs behave quite differently.

Meanwhile I found “FrameVelocity” and “Heading” which totally solved my problem! But I’ll write down “Point2Vec” and “Vec2Point” cos most probably I’ll use these in the future.

Thank you!
Nuno