Go Back   Winamp Forums > Visualizations > AVS

Reply
Thread Tools Search this Thread Display Modes
Old 4th July 2007, 05:31   #1
J.Melo
Senior Member
 
J.Melo's Avatar
 
Join Date: Oct 2006
Posts: 328
Jus Wonderin

Is there any difference between atan(a/b) and atan2(a,b)?
J.Melo is offline   Reply With Quote
Old 7th July 2007, 11:39   #2
Grandchild
Senior Member
 
Grandchild's Avatar
 
Join Date: Oct 2005
Location: Germany
Posts: 324
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
Grandchild is offline   Reply With Quote
Old 7th July 2007, 15:02   #3
J.Melo
Senior Member
 
J.Melo's Avatar
 
Join Date: Oct 2006
Posts: 328
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 is offline   Reply With Quote
Old 7th July 2007, 15:17   #4
J.Melo
Senior Member
 
J.Melo's Avatar
 
Join Date: Oct 2006
Posts: 328
I had to post a new reply because apparently you cant attatch a file while editing
Attached Files
File Type: zip atan test.zip (250 Bytes, 98 views)
J.Melo is offline   Reply With Quote
Old 9th July 2007, 04:58   #5
Grandchild
Senior Member
 
Grandchild's Avatar
 
Join Date: Oct 2005
Location: Germany
Posts: 324
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]:
Attached Files
File Type: zip atan test2.zip (464 Bytes, 135 views)
Grandchild is offline   Reply With Quote
Old 9th July 2007, 09:47   #6
J.Melo
Senior Member
 
J.Melo's Avatar
 
Join Date: Oct 2006
Posts: 328
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.
J.Melo is offline   Reply With Quote
Old 11th July 2007, 12:33   #7
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
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.
shreyas_potnis is offline   Reply With Quote
Old 11th July 2007, 16:23   #8
J.Melo
Senior Member
 
J.Melo's Avatar
 
Join Date: Oct 2006
Posts: 328
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?
Attached Files
File Type: zip atan vs atan2.zip (240 Bytes, 147 views)
J.Melo is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Visualizations > AVS

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump