02-19-2006 11:20 PM
atan2(x,y) | Inverse Tangent (2 Input) | Computes the arctangent of y/x in radians. |
02-20-2006 12:12 AM
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-20-2006 12:17 AM
02-20-2006 12:44 AM
02-20-2006 04:24 AM
Hi Paul,
You are right - the formala node atan2() function's documentation is wrong.
The documentation says "atan2(x,y)" but as you have discovered, it should read atan2(y,x).
It's easy to see how the error occured, as it's normal to write coordinates as (x,y).
Of course the error should only be corrected in the documentation, because if the function inputs were reversed to matched the existing documentation then this would break any existing code that uses the function.
Mark.
02-20-2006 04:36 AM
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-20-2006 06:00 AM
Hi TiTou,
There is no problem with the normal VI style function (the "Inverse Tangent (2 Input)" VI function) - that's O.K.
The error is in the documentation of the equivalent formula node function (text functions, similar to "C" code) - the documentation describes the function as "atan2(x,y)" - but actually it will only give the correct result if you reverse the x and y input values i.e. atan2(y,x) - it's simply a small, but potentialy confusing, documentation error.
Amusingly, even my HP Basic documentation (Transera HTBasic) gets a bit muddled - although it correctly documents the syntax as Atn2(y,x), it then mentions Atn2(x,y) in the further description (again, accidentaly reversing y and x inputs).
Mark.
02-20-2006 06:03 AM
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus