Search code examples
mathargumentsconventions

Why are the arguments to atan2 Y,X rather than X,Y?


In C the atan2 function has the following signature:

double atan2( double y, double x );

Other languages do this as well. This is the only function I know of that takes its arguments in Y,X order rather than X,Y order, and it screws me up regularly because when I think coordinates, I think (X,Y).

Does anyone know why atan2's argument order convention is this way?


Solution

  • Because it is related to arctan(y/x), so y appears first.

    Here's a nice link talking about it a bit: Angles and Directions