please help me understand:

  1. What’s the point of ArcTan2?
  2. In what situation would a person prefer using it over ArcTan1?
  3. What is its Mathematical function?

My thoughts:

The function of ArcTan1 is ArcTan1(y/x) = θ.
Is the point of ArcTan2 that it allows us to decide the coordinates of input ratio ourselves? Meaning we can have…
ArcTan2(x/y) , ArcTan2(x/z)
ArcTan2(y/x) , ArcTan2(y/z)
ArcTan2(z/x) , ArcTan2(z/y)
…if we want, unlike with ArcTan1(y/x), we could only have one ratio which is y/x, which can be considered a disadvantage?

My thoughts (2):
enter image description here

enter image description here

From what I know:
-Invertible Tan1 has its Domain restricted to (−π/2,π/2) so that it can be invertible, and its inverse (i.e. ArcTan1) outputs Range (−π/2,π/2) only on First & Forth Quadrants.
-Now, with what we see here (the Blender screenshot), ArcTan2 outputs angles that are in all four quadrants. Which means, its inverse, which is Tan2 (which doesn’t exist), has Domain to be (−∞,+∞) (including the asymptotes x = n*(π/2)), and is not invertible, for ArcTan2 to be able to output such angles.

Here’s my assumption, please tell me what you think:

  • ArcTan2 is not an inverse of any function (even though it has “arc” in its name), it’s a separate function. It’s not supposed to be Mathematically intuitive or theoretically correct, it’s just created to be a more versatile version of ArcTan1, it’s supposed to simply input arbitrary ratios (decided by Blender users) and output angles. Both of its Domain and Range are (−∞,+∞).

Could someone please write for me a complete function of ArcTan2 Mathematically?

My thoughts (3):
I don’t understand what’s with the abrupt change at π. I know the angles of a circle have to start and end somewhere but why at π? What is its Math like to create such result?

Thank you so much!

  • 1
    $\begingroup$ I wondered the same thing (with less research!). Might need to ask a developer. $\endgroup$ Sep 28, 2023 at 3:59
  • 5
    $\begingroup$ Sorry, this is not a question about issues with using Blender. It is mathematics, the function is not Blender-specific. If you want to understand the function, try this Wikipedia article: en.wikipedia.org/wiki/Atan2?wprov=sfla1 $\endgroup$ Sep 28, 2023 at 4:37
  • 6
    $\begingroup$ arctan2 takes two inputs, i.e. arctan2(y, x), and it correctly infers in which quadrant the coordinates are, and can therefore yield a result between -180° and 180°, whereas arctan only takes one input, and yields an angle that is either in the first or in the fourth quadrant, i.e. -90° to 90°. $\endgroup$ Sep 28, 2023 at 4:39
  • 3
    $\begingroup$ Your questions 1, 2 and 3 are all answered in the Wikipedia article. 1: read the section "Motivation". 2: In situations where the motivation (see 1) is asking for it, for example (quote): "The atan2 function is useful in many applications involving Euclidean vectors such as finding the direction from one point to another or converting a rotation matrix to Euler angles." 3: read the section "Definition and computation". Maybe you see no use in it, but it is implemented in programming languages long before Blender existed and does not need to have an obvious purpose for texturing. $\endgroup$ Sep 28, 2023 at 6:37
  • 2
    $\begingroup$ Considering that arctan2 was first implemented in Fortran in 1961, and has since been implemented in practically every major programming language, it must be considered a widely used function, and it is well documented. It's far from unique to Blender. The link provided by @GordonBrinkmann explains it well, and if that is not satisfactory, please explain how your question is specific to a Blender issue that you are trying to resolve. $\endgroup$ Sep 28, 2023 at 6:38

1 Answer 1


If you consider any point, (x, y), a vector, that starts at world origin, then the quotient y/x is equal to tan of the counter-clockwise angle between the X axis and the vector (x, y). Since, for example, (-0.5)/0.3 is equal to 0.5/(-0.3), and (-0.5)/(-0.5) is equal to 0.5/0.3, tan does not represent the whole range -pi to pi (or 0 to 2xpi if you will). If you add pi to any angle, the resulting angle will have the same tangent as the original one, e.g. tan(pi/4) = tan(5*pi/4).

To remedy this limit in tan and arctan, arctan2 was implemented, taking two arguments, y and x. The arctan2 has been around since before I was born, and I can only speculate on the reason for the reversed argument order, but a reasonable guess is that it represents the fact that the quotient y/x is equal to the tangent. y and x are, by no means, just a random ratio. They are the actual coordinates of a point, and arctan2 yields the angle between the X axis and the vector (x, y). If the angle it yields is positive, it goes counter-clockwise from the X axis to the vector (x, y), and if it is negative, it goes clockwise from the X axis to the vector (x, y).
arctan2(y, x) essentially calculates arctan(y/x) then uses the respective signs of x and y to infer which quadrant the coordinates are in, to be able to add or subtract the correct value. Under the hood it is a bit more involved, as it also includes logic to be able to handle situations that would otherwise require division by zero, i.e. when x=0, and situations where one or both the coordinates are infinites. On systems that support signed zeros, it can also infer the correct quadrant for the origin point, based on the signs of the zeros.

To summarize the relation between arctan and arctan2:
if x and y are positive real numbers the following holds true.

  • arctan2(y, x) = arctan(y/x)
  • arctan2(-y, x) = arctan(y/x)-pi/2
  • arctan2(y, -x) = arctan(y/x)+pi/2
  • arctan2(-y, -x) = arctan(y/x)+pi

Simple 3D render of z = arctan2(y, x), with -5 <= x <= 5, and -5 <= y <= 5. z is in the range -pi < arctan2(y, x) <= pi. The hue of the graph is linearly mapped to z.

3D rendering of z = arctan2(y, x)

  • 1
    $\begingroup$ Thank you! I have a few questions: ----1---- By observing its graph, what kind of function is ArcTan2 that allows one input (y/x ratio) to be assigned to multiple outputs (angles)? ----2---- Why did they define the Range of ArcTan2 as (−π,π] and the Range of ArcTan1 as (−π/2,π/2], why the mix of Open and Closed interval? Why aren’t −π and −π/2 included in the Range? They however defined the Range of ArcTan1 as purely Open interval (−π2/,π/2) in the Motivation section, but not in other sections. $\endgroup$ Sep 28, 2023 at 14:56
  • 2
    $\begingroup$ @IanAmbrose arctan2(y, x) essentially calculates arctan(y/x), and then uses the respective sign of x and y to determine which the quadrant it belongs, to add or subtract the correct value. The one-ended openness is due to the fact that -pi and +pi represent the same angle. If you start at -pi, and go full circle, by adding 2xpi, you'll end up where you started. -pi/2 and pi/2 do not represent the same angle, and arctan's output is closed at both ends, i.e. arctan(-inf) yields -pi/2, and arctan(inf) yields +pi/2, provided, of course, the system supports infinities. $\endgroup$ Sep 28, 2023 at 15:19
  • 2
    $\begingroup$ Nicely done .. the only reason I didn't take a shot at this, was suddenly wondering: Why don't we have asin2() and acos2(), as well ?.. I'm probably being dim, again.. :) $\endgroup$
    – Robin Betts
    Sep 28, 2023 at 16:18
  • 1
    $\begingroup$ @RobinBetts I can't give a definitive answer, but the goal of the arcus functions are to obtain an angle, and with the knowledge of x and y you can do that using atan2(), and asin2() or acos2() would both yield the same result as atan2() from the same input parameters, Why have three functions yielding the exact same result from identical input? :) You're not being dim. Lack of knowledge isn't dimness. :) $\endgroup$ Sep 28, 2023 at 21:31
  • 1
    $\begingroup$ @IanAmbrose What's input to arctan2() are the x and y coordinates. From these it essentially calculates arctan(y/x), and then it uses the respective signs of x and y to determine what quadrant the coordinates are in, and uses that to add or subtract a value, to get the correct angle. You can, if you want to, use it as a multivariate function, and 3D plot it, but its main purpose is to determine the angle between the X axis and the vector (x, y). I'm sorry if this is unclear, but I can't explain it any better. Difficulty explaining things is a shortcoming of mine, of which I'm aware. $\endgroup$ Sep 29, 2023 at 4:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .