Hi all,
I understand issues around this function have been discussed in great detail and I'm very thankful for the many helpful contributions on this topic (particularly from Roger Stafford) to date… they have helped me immensely with my work. But I was hoping to ask just one more question about it (sorry!).
I understand that creating the vector cross product and scalar dot product allows me to pass the sin and cosine to atan2 function to calculate the angle between 2 3D vectors (important for accuracy and also practical if vectors aren't normalised – as I understand it anyway). What I am unsure of is the maths or formula behind the atan2 function. I would like to know what it is and was wondering if anyone could help?
My guesses are that it might be something like:
atan2 = 2arctan(y/x)
where y = dot product and x = norm of cross product if x > 0.
Or
atan2 = 2arctan(y/(sqrt(x.^2+y.^2)+x)
where y = dot product and x = norm of cross product if x > 0.
Hopefully someone can tell me if I'm wrong/right and point me in the right direction.
Thanks in advance!
Best Answer