Comment by adrian_b
4 days ago
There are many applications where instead of angles it is more convenient to use the Y to X ratio (also the Z to X ratio in 3D), i.e. to use the tangent of the angle as a scalar that encodes the direction.
In 2D, using either the angle or its tangent needs a single number. The third alternative is, as others have mentioned, to use a complex number (i.e. the cos and sin couple).
Any of these 3 (angle, tangent of angle and complex number) may be the best choice for a given problem, but for 2D graphics applications I think that using a complex number is more frequently the best. For 3D problems there are 3 corresponding alternatives, using a pair of angles, using a pair of tangents (i.e. coordinate ratios) or using a quaternion.
Specifying directions by the ratio between increments in orthogonal directions, instead of using angular measures, has always been frequent in engineering, since the Antiquity until today.
For something like cursor movement, the ratio between Y pixels and X pixels clearly seems as the most convenient means to describe the direction of movement.
That's right. However, one disadvantage of using the tan value (the y/x ratio) over that of (cos,sin) tuple is that the former loses information on whether the y coordinates or the x coordinate was negative.
So, if you use the tan representation you have to carry that information separately. Furthermore, the code needs to correctly handle zero and infinity.
Tan of the half angle takes care of the first problem and is related to the stereographic transform. This works modulo one full rotation.
It is also revealing that in Fourier series, the phase angle is represented as a sin, cos tuple and not as a scalar.