jheriko
5th October 2002 04:45 UTC
Wacky crashing
Okay, i've been trying to make an equiangular spiral in AVS using a superscope by using the forumla d=e^r*cot(angle), which converts to avs code to look something like:
r=blah*i-something;
d=pow(2.718281828,r/tan(angle));
x=d*cos(r);
y=d*sin(r);
Now the problem is that once I type all of the code AVS will either crash and close, display a blank screen and claim it is rendering at something like 60fps then not change preset when i choose a new one or it will crash winamp. Is there something horribly wrong with my code that I have missed? I tried doing it ina an alternate method which worked when i reloaded the preset after saving but making any changes to it causes my computer to freak out and slow down. I've attached this version to the post since it isn't so completely random bug causing.
Anyway, does this have any link to a known avs bug or am i missing something blatantly obvious. Please play around with the attached preset to see if you suffer any similar problems.
Maybe I've just watched 'pi' too many times...
UnConeD
5th October 2002 15:54 UTC
Btw you can use exp(a) instead of pow(2.718, a). It's much faster because in assembly, only powers of e and natural logarithms are supported, so using pow() automatically adds a multiplication to change the base.
The other undocumented AVS function is atan2. There aren't any others (I studied vis_avs.dll to confirm :))
I think the problem is that your spiral is too large. If you're using e^(r*cotan(angle)) your radius can easily get huge. And if you're using lines, AVS will not clip them and attempt to draw the pixels that are outside of the window too.
I'm not 100% sure about this, but I do know that if you don't clip 3D superscopes at (z > .01) or similar, AVS can stall at random points. It will stop responding for a while, and then suddenly continue.
Btw instead of using 1/tan(a) as cotan(a), why not use tan(pi/2-a)? Should be faster than a division.
Jaheckelsafar
5th October 2002 23:11 UTC
Originally posted by UnConeD
Btw instead of using 1/tan(a) as cotan(a), why not use tan(pi/2-a)? Should be faster than a division. [/B]
Aren't you just substituting one division for another,and tossing in a subtraction to boot? :p
UnConeD
6th October 2002 02:31 UTC
Errr no because you can calculate pi/2 on beforehand. I was talking mathematically, not in AVS code.
jheriko
6th October 2002 04:29 UTC
Ignore my mathematical incompetence lately, it will all get back up to scratch soon. I have a huge book on Riemann integrals sitting here for me to read, I'm sure I'll find some way of making them do something for avs. Anyway I gave up on my spiral it just would not run in a stable fashion, crashes all over the place and not too great a superscope either, I'm gonna stick to working on heavy 3d stuff and 'animations'.