Skip to content
Forum Archive

Jus Wonderin

8 posts

Grandchild#
i think it's faster because it's implemented so it doesn't have to translate the 'a/b' from avs-code to "computer-code" anymore.
but the difference will be hardly noticeable if you don't use it in the pixelbox with, say, n=5000 so it'll be executed 5000 times per frame.

gc
J.Melo#
Ok, so It's just a bit faster then?

Edit: I just tested it and I got 120+-5 fps for atan and only 90+-5 fps for atan2.

???

Why would there be an atan2 function then? Try it on your PC. Maybe it varies between processors, or somthin. Use this preset. Just change the atan func. to atan2.
J.Melo#
I had to post a new reply because apparently you cant attatch a file while editing
Grandchild#
it seems you're right... strange.

but now i remember that in pak-9's programming tutorial he says that atan2 comes with some additional features like avoiding division by zero and some wrapping around the "ends" of a circle [you know, between r=0 and r=2*$PI]
/looks into the guide
hm can't find it now, maybe he told me on irc one time, i don't know.
when i use atan instead of atan2 in a movement there are some glitches to be found but they really are minor. and there's a small dot in the middle of the screen. plus it's slightly slower than atan2.
so i think it might actually be sometimes faster to use atan(a/b) than atan2(a,b) in an ssc but i'll stick to atan2 in movements.

but have a look [it's all in the movement]:
J.Melo#
I see what you mean. The edges look so much smoother in atan2, and there is no dot in the middle. I did get about 3 fps faster in atan2 also.
shreyas_potnis#
atan2 returns the correct angle that the vector (a,b) makes with the x-axis....atan(b/a) returns, well just that.
like atan((-3)/4) and atan(4/(-3)) will be the same but atan2 wont be.
J.Melo#
atan((-3)/4) and atan(4/(-3)) are different. The thing is, atan(4/-3) and atan2(4,-3) are not the same. I found something in an AVS preset. Anyone wanna process it and explain?