atan2(y,x): x and y switched?

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°.

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.

The image is from https://fr.wikipedia.org/wiki/Atan2 and they use atan2(y,x).

Anyway, depending on the software, it’s either atan2(x,y) or atan2(y,x). For this function, it could be simply documented by “atan2(x,y)”. Thanks.

atan2(y,x) is the usual order of arguments, as in, the angle to the x axis is atan(y/x).