
When supplying math.atan(x/y) it does have the regular behaviour, but then you can't get the complete anlge as specified by the lua documentation:
it seems that factorio ignores the second input of atan and always return atan(x).math.atan
Return the inverse tangent in radians. We can do this by supplying y/x ourselves or we can pass y and x to math.atan to do this for us.Using two arguments should usually be preferred, particularly when converting rectangular co-ordinates to polar co-ordinates. It will use the sign of both arguments to place the result into the correct quadrant, and also produces correct values when one of its arguments is 0 or very close to 0.Code: Select all
> c, s = math.cos(0.8), math.sin(0.8) > = math.atan(s/c) 0.8 > = math.atan(s,c) 0.8
Code: Select all
> = math.atan(1, 0), math.atan(-1, 0), math.atan(0, 1), math.atan(0, -1) 1.5707963267949 -1.5707963267949 0 3.1415926535898