Kewl's picture

In the Calculate node, it seems the atan2(y,x) function has the x and y switched. Normally, atan2(1,0) should give 0, but it gives 90° (pi/2): it's atan2(0,1) that should give 90°.

I'm using atan2(y,x) to convert cartesian coordinates to polar coordinates, but everyting is offset by 90°.

Comments

No, that's the usual way for

jstrecker's picture
Submitted by

No, that's the usual way for atan2 to work — https://en.wikipedia.org/wiki/Atan2#Illustrations

As your illustration shows, 0 radians (0°) is at the point x=1, y=0 — but since it's standard for the arguments to atan2 to be y then x, you would call atan2(0,1) to get this value.

Similarly, for π/2 radians (90°), at the point x=0, y=1, you would call atan2(1,0).

I guess they put the arguments as y then x because the arctangent uses the ratio y/x.