In a variety of computer languages, the function atan2 is the arctangent function with two arguments. The purpose of using two arguments instead of one is to gather information on the signs of the inputs in order to return the appropriate quadrant of the computed angle, which is not possible for the single-argument arctangent function. (Source: Wikipedia)
Another variation of "Direction Bitmap" https://scratch.mit.edu/projects/80052660/ With a more practical approach.