Old 1st August 2004, 01:46   #1
NemoOrange
Senior Member
 
NemoOrange's Avatar
 
Join Date: Jan 2003
Location: Philadelphia, USA
Posts: 135
Send a message via AIM to NemoOrange
cannot render perfectly 45 degree lines

This is in reference to the problem I was having this thread:

http://forums.winamp.com/showthread....hreadid=184860

So I'm working on a scope that basically moves in 45 degrees, point by point. So, its at one spot, then moves a certain distance 45 degrees away from that spot.

But, due to what seems to be a rounding error in AVS, every couple of frames, the point will move off by one pixel, & then back to the correct per-pixel path.

& the real kicker is that when you set the width of the AVS window to 284 or 756 (height does not matter), this doesn't happen at all.

I'm quite perplexed & if anyone could help, it would be of great assistance.
NemoOrange is offline   Reply With Quote
Old 4th August 2004, 09:05   #2
vanderphunck
Junior Member
 
vanderphunck's Avatar
 
Join Date: Jul 2004
Location: Finland
Posts: 47
I suppose you do something like this:


[frame]
speed=1/w;


[beat]
rr=rand(8)*$pi/4;
vx=cos(rr);
vy=sin(rr);

x=0;y=0;

[point]
x=x+speed*vx;
y=y+speed*vy;


There's definitely some rounding errors in this... My first suggestion would be to round vx and vy like this:

vx=floor(cos(rr)+.5);
vy=floor(sin(rr)+.5);

That helped for me... But is ofcourse not exactly the same...
vanderphunck is offline   Reply With Quote
Old 4th August 2004, 09:58   #3
vanderphunck
Junior Member
 
vanderphunck's Avatar
 
Join Date: Jul 2004
Location: Finland
Posts: 47
Actually the above does not work... but this does:

[init]
n=1000;rr=1;
[frame]
vx=floor(cos(rr*$pi/4)+.5);
vy=floor(sin(rr*$pi/4)+.5);

[beat]
rr=rr+1;
xp=floor(w/2);yp=floor(h/2);

[point]
xp=xp+vx;
yp=yp+vy;

x=(xp+.5)*2/w-1;
y=(yp+.5)*2/h-1;



---------

here i'm calculating the position in pixels. The weird thing is that it does not work unless i add the .5 as in the last 2 lines. I hope this helps...
vanderphunck is offline   Reply With Quote
Old 5th August 2004, 10:21   #4
Rovastar
Moderator
 
Join Date: Jun 2001
Location: London, England
Posts: 3,632
Send a message via AIM to Rovastar
Yeah don't worry to much about the .5 thing I have seen similar things in MilkDrop and R4 visualizations among other and I can imagine AVS being no different.

This coudl well be due to a grid like system and positioning the 'centre' point of teh grid. you will have to shift the 'centre' along.

I explain more here

http://www.rabidhamster.org/phpBB2/v...&highlight=map

but it is in a bit of R4 pseudo-code speak though. and talking about mapping....umm I suppose DM's would be a similar thing. MAybe not the same thing but maybe gives some ideas about the theory behind the 0.5 bit.

"Rules are for the guidance of wisemen and the obedience of fools"

Visuals - Morphyre www.Morphyre.com
Rovastar is offline   Reply With Quote
Old 9th August 2004, 15:18   #5
NemoOrange
Senior Member
 
NemoOrange's Avatar
 
Join Date: Jan 2003
Location: Philadelphia, USA
Posts: 135
Send a message via AIM to NemoOrange
Thanks so much Phunck!

The pixel positioning solution is exactly what I was looking for. Works perfectly.
NemoOrange is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Troubleshooting

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 Off
HTML code is Off

Forum Jump