Hello and thank you very much for your comment! Glad my approach worked out for you! It's always a tough problem when it comes to how much context to include to make this beneficial for the most amount of people (while also of course, not boring them out!) I did gloss over a lot of the math behind trigonometry though, focusing only on the bare minimum required to understand atan2(). For other applications, there's always more to learn!
Most of the early years of programming is just discovering some guy or gal in the 80s or 90s figured out the solution to the problem you're working on and game development is no exception.
Hello and thank you for your comment! Most certainly! Even the super trendy things today like deep learning were developed in the 60s and 70s. But that's a happy problem. When there are well-established solutions to common problems, it means that you can devote your time towards _not_ reinventing the wheel!
Thank you. Was trying to understand this, in surveying I use Arctan x/y, because of 0 degrees being north, then we go clockwise instead of counter clockwise. I was using Arctan in excel with if statements to choose the quadrant given the signs. Now I can use =ATAN2(deltaN, deltaE) and I will get the same result. I have set up an IF statement if the angle is less than 360 to add 360, otherwise it is the correct angle. Works well. Thank you for helping me visualise the unit circle and relate it to the compass bearings we are used to after using them for so long.
@@NERDfirstone question. When you apply atan to the UVs in fragment shader code, why does one half of the surface is totally black and out of the remaining 2 quadrants, one is bright white and only the last quadrant appears to show the blend between black and white colors?
@@theman7050 Without knowing what your code is doing or what your texture looks like, it'd be hard to say. Usually when textures don't look right, it's because your UVs are off, but without digging further into exactly how the UVs are off, it wouldn't be easy to debug.
@@NERDfirst While pure mathematicians might only be concerned whether something is theoretically resolvable, engineers are concerned whether a solution is more efficient than the other.
I just noticed that there are a number of webpages devoted to the question: Why aren't there *asin2()* and *acos2()* functions? After thinking a bit about it, I realized that this is because atan2 relies on the value of atan(y/x) along with the signs of x and y. But this task can also be accomplished by using asin(y/sqrt(x^2+y^2)) or acos(x/sqrt(x^2+y^2)) along with the signs of x and y. So the function could have been called something like angle_finder().
Hello and thank you for your comment! I suppose it's associated with the mathematical atan function just because it works similarly enough! By naming it that way, if you understand atan, you already know what the function does.
Hello and thank you for your comment! This isn't generally something that can be easily done. I wouldn't be surprised if even calculators use approximations or look-up tables. But if you wanted to do it anyway, the method is described in detail here: math.stackexchange.com/questions/4680996/find-arctan-without-calculator
Thank you great video very helpful. I was wondering if I were to use a calculator to find the answer what would I insert? because as you know the simple tan-1(y/x) wouldn't give the right answer for quadrants 2 and 3
Hello and thank you for your comment! Unfortunately if you have, say, a scientific calculator, you don't have access to something like atan2(). This means you'll have to eyeball it yourself based on the quadrant to decide what the angles will be.
Hello and thank you for your comment! This depends on the conventions used by your game engine / programming framework. Sometimes, angles are represented as -180 to 180 degrees, rather than 0 to 360 degrees. For example, I have seen conventions in which +X (ie. East), is taken to be 0°. Angles going counterclockwise from there are positive, so +Y (North) is 90°. Angles going clockwise are negative, so -Y (South) is -90°. Ultimately, it's just a matter of conventions - different ways to point out the same directions.
Hello and thank you for your comment! I personally don't really see a need to use atan() ever - I always find myself using atan2(). I'm not aware of any advantages to using atan(), and honestly it probably only exists to more closely mirror the function you'd find on a calculator.
Hello and thank you for your comment! Are you talking about the tallest cable in the middle? If so, that's the power cord for the Ikea lamp I'm using to light up the set, and it's meant to flex like that! There's a strain relief structure on the plug and the lamp's still going strong today.
Hello and thank you for your comment! Could you elaborate more? The examples given in the video are given in the context of finding the heading of one point relative to another, which is a fairly common use case in graphics and games.
Hello and thank you for your comment! It's never too late! I too never went out of my way to understand this for a while, and continued using regular old atan() supported by a bunch of if-statements for a very long time.
I almost lost my mind to figure out WTF is Atan2, and you just saves my day!! Thank you so much!!!!
You're welcome! Very happy to be of help =)
this is extremelye helpful, especially when your teacher doesnt understand code himself so you gotta figure things out to pass
Hello and thank you for your comment! Very happy to be of help =)
It's very concise and easy to grasp. I was googling atan2 but I was bombarded with lots of technical jargon. Great job!!
Hello and thank you very much for your comment! Very happy to be of help =)
God, thank you for explaining this in a rational way for people who don't have years of mathematics education to make this intuitive.
Hello and thank you very much for your comment! Glad my approach worked out for you! It's always a tough problem when it comes to how much context to include to make this beneficial for the most amount of people (while also of course, not boring them out!)
I did gloss over a lot of the math behind trigonometry though, focusing only on the bare minimum required to understand atan2(). For other applications, there's always more to learn!
Most of the early years of programming is just discovering some guy or gal in the 80s or 90s figured out the solution to the problem you're working on and game development is no exception.
Hello and thank you for your comment! Most certainly! Even the super trendy things today like deep learning were developed in the 60s and 70s.
But that's a happy problem. When there are well-established solutions to common problems, it means that you can devote your time towards _not_ reinventing the wheel!
Perfect explanation thank you!
You're welcome! Very happy to be of help :)
atan2 is probably the most used function from the standard math library in 3d games :P
Hello and thank you for your comment! I'm not surprised! There's so much Trigonometry going on in 3D.
This was brilliant. short, simple. to the point. giving basic understanding of Atan originally and then comparing and the use of diagrams
Hello and thank you very much for your comment! Glad you liked the video =)
Been using it, but never quite understood why. Great vid!
Hello and thank you very much for your comment! Very happy to be of help =)
Bruh thank you. Finding the angle between two points is super useful,
You're welcome! Very happy to be of help :)
Thank you. Was trying to understand this, in surveying I use Arctan x/y, because of 0 degrees being north, then we go clockwise instead of counter clockwise.
I was using Arctan in excel with if statements to choose the quadrant given the signs.
Now I can use =ATAN2(deltaN, deltaE) and I will get the same result. I have set up an IF statement if the angle is less than 360 to add 360, otherwise it is the correct angle. Works well.
Thank you for helping me visualise the unit circle and relate it to the compass bearings we are used to after using them for so long.
Hello and thank you very much for your comment! Yes, this really needs to be visualized for it to make sense, so I'm glad I could do that for you!
commenting to feed the algorithm because this helped me understand the function a lot better :)
Hello and thank you very much for your comment! Glad to be of help :)
Thanks man. I keep coming back to refer this video 😊
You're welcome! Glad to be of help =)
@@NERDfirstone question. When you apply atan to the UVs in fragment shader code, why does one half of the surface is totally black and out of the remaining 2 quadrants, one is bright white and only the last quadrant appears to show the blend between black and white colors?
@@theman7050 Without knowing what your code is doing or what your texture looks like, it'd be hard to say. Usually when textures don't look right, it's because your UVs are off, but without digging further into exactly how the UVs are off, it wouldn't be easy to debug.
simple and clear. Thank you. mozambican from Brazil.
You're welcome! Glad to be of help :)
Great video. Thank you!
You're welcome! Glad you liked the video =)
lol sitting in a coffee shop called Well and Good (a phrase you said in the video). Glad you made this, helped.
Ha, nice coincidence :) Very happy to be of help!
thank you so much I've looking in how to do it for so much time!!!
You're welcome! Very happy to be of help :)
Simple but Profound! Thank you! :)
You're welcome! Very happy to be of help =)
Great explanation, keep up the good work!
Hello and thank you very much for your comment! Very happy to be of help :)
The sad thing is that many people have extensively used functions asin, acos and atan but are still unaware of the existence of atan2.
Hello and thank you for your comment! Well to be fair, coming from a math perspective, people may not even be aware that this could be a problem!
@@NERDfirst While pure mathematicians might only be concerned whether something is theoretically resolvable, engineers are concerned whether a solution is more efficient than the other.
I didn't quite get the wikipedia explanation but this was easypeasy to understand thanks!
You're welcome! Very happy to be of help :)
Fantastic video. So well done. Thank you!
You're welcome! Very happy to be of help =)
Thank you. It finally makes sense :)
You're welcome! Glad to be of help :)
thank you so much! very helpful!
You're welcome! Very happy to be of help :)
Perfect explanation, thanks!
You're welcome! Happy to be of help =)
It helps me to find out more what iam doing now. Thanks
You're welcome! Very happy to be of help =)
Thank you for this nice video!
You're welcome! Glad to be of help =)
I just noticed that there are a number of webpages devoted to the question: Why aren't there *asin2()* and *acos2()* functions? After thinking a bit about it, I realized that this is because atan2 relies on the value of atan(y/x) along with the signs of x and y. But this task can also be accomplished by using asin(y/sqrt(x^2+y^2)) or acos(x/sqrt(x^2+y^2)) along with the signs of x and y. So the function could have been called something like angle_finder().
Hello and thank you for your comment! I suppose it's associated with the mathematical atan function just because it works similarly enough! By naming it that way, if you understand atan, you already know what the function does.
Very very well explained! Thanks!
You're welcome! Glad you liked the video =)
Thanks man i really needed this
You're welcome! Glad to be of help =)
great information. 😎 Thanks.
You're welcome! Very happy to be of help :)
Thank you, man!!!!!!!!!
You're welcome! Glad to be of help =)
Is there a way to solve for ArcTan2 without a script, for instance on paper? Great video
Hello and thank you for your comment! This isn't generally something that can be easily done. I wouldn't be surprised if even calculators use approximations or look-up tables.
But if you wanted to do it anyway, the method is described in detail here: math.stackexchange.com/questions/4680996/find-arctan-without-calculator
Thank you great video very helpful. I was wondering if I were to use a calculator to find the answer what would I insert? because as you know the simple tan-1(y/x) wouldn't give the right answer for quadrants 2 and 3
Hello and thank you for your comment! Unfortunately if you have, say, a scientific calculator, you don't have access to something like atan2().
This means you'll have to eyeball it yourself based on the quadrant to decide what the angles will be.
@@NERDfirst thank you vary mush . I had a test and this video helped me a lot. You explained it way better than my professor
You're welcome! Hope the test went well.
Thank you, for really nice explanation :D
You're welcome! Glad to be of help :)
brother in my game after get value from atan2() i need to get negative of atan2() like angle = - atan2(y,x) why that happen ?
Hello and thank you for your comment! This depends on the conventions used by your game engine / programming framework. Sometimes, angles are represented as -180 to 180 degrees, rather than 0 to 360 degrees.
For example, I have seen conventions in which +X (ie. East), is taken to be 0°. Angles going counterclockwise from there are positive, so +Y (North) is 90°. Angles going clockwise are negative, so -Y (South) is -90°. Ultimately, it's just a matter of conventions - different ways to point out the same directions.
@@NERDfirst thank you i got what you mean , i hope your channel be bigger
It's helpful. Thanks a lot
You're welcome! Very happy to be of help =)
Great explanation!! Thank you!
You're welcome! Glad to be of help =)
This was exactly what I wanted to find when I searched mathf.atan2
Hello and thank you for your comment! Glad to be of help =)
Thanks man, it was very helpful 👍
You're welcome! Happy to be of help =)
Legend.
Hello and thank you for your comment! Glad to be of help =)
Very helpful video!! small question: Why don't we just use atan2 all the time since it's so much better than atan?
Hello and thank you for your comment! I personally don't really see a need to use atan() ever - I always find myself using atan2(). I'm not aware of any advantages to using atan(), and honestly it probably only exists to more closely mirror the function you'd find on a calculator.
great job!
Hello and thank you very much for your comment! Glad you liked the video :)
Thank you soooo much,
my robotics teacher didn't make me understand!
You're welcome!Glad to be of help =)
thank you sir!
You're welcome! Glad you liked the video =)
Is your white charging cable okay?
Hello and thank you for your comment! Are you talking about the tallest cable in the middle? If so, that's the power cord for the Ikea lamp I'm using to light up the set, and it's meant to flex like that! There's a strain relief structure on the plug and the lamp's still going strong today.
Thank you. Such a Chad.
You're welcome! Happy to be of help :)
I confuse atan with atan2 haha. Thanks for the vídeo
You're welcome! Glad to be of help =)
a concrete example would have been nice
Hello and thank you for your comment! Could you elaborate more?
The examples given in the video are given in the context of finding the heading of one point relative to another, which is a fairly common use case in graphics and games.
thank you sir
You're welcome! Glad to be of help =)
Thanks man
You're welcome! Glad to be of help =)
Wish I knew this few years ago lol
Hello and thank you for your comment! It's never too late! I too never went out of my way to understand this for a while, and continued using regular old atan() supported by a bunch of if-statements for a very long time.
Roses are red
violets are blue
There's always a Asian better then you
wait , I'm also Asian 0_0
I live in a country full of Asians =P So, nothing special here!
@@NERDfirst y'all got superpowers, of the intellectual variety, so i heard
@@Retrofire-47 Hah, I wouldn't know, everyone around me is Asian too!
at times you sound just a little bit like rayner teo
Hello and thank you for your comment! Not surprising since he and I are from the same country =)
like