Game Development Community

What does mAtan(%num,%run) mean?

by ShaoWei · in Technical Issues · 11/23/2007 (11:55 pm) · 7 replies

What does mAtan(%num,%run) second argument %run mean?
I see that in Advanced 3D Game Programming All IN One, page 188.
It wrote that %angle = mRadToDeg(mAtan(%slope,-1)
It is to sovle an angle between two points, but I do not know how it functioned.

#1
11/24/2007 (1:20 am)
I know very little in this degree of math but for what it is worth this is the Arctangent function.
#2
11/26/2007 (9:09 pm)
Thanks for Brian West's reply, but Actangent function only need one argument, however, there are two arguments!?
#3
11/26/2007 (10:16 pm)
ATan2.
#4
11/27/2007 (12:00 am)
ATan2(x, y) which is really what this is just boils down to: ATan(x / y)

It is just more appropriate to send both arguments so that the function can guard against divide by zero.
#5
11/27/2007 (1:12 pm)
More info: The bad input for atan2 is atan2(0.0, 0.0) and the mAtan method does NOT check for this: it just "wraps" the C++ math library atan2 function. You have to check for and protect against both arguments being zero yourself.
#6
11/29/2007 (2:46 am)
Thanks for all of you, I got it.
#7
11/29/2007 (12:51 pm)
MAtan doesn't check both arguments... that seems like an oversight in the engine.