Winamp & Shoutcast Forums > AVS Pixel Placement

 28th June 2004, 06:07 #1 horse-fly Account Closed     Join Date: Apr 2001 Posts: 2,360 Pixel Placement Is there a way to define a superscope by a certain pixel position, rather than ratio?
 28th June 2004, 10:09 #2 Deamon Major Dude     Join Date: Nov 2002 Location: Arnhem, the Netherlands Posts: 927 in frame: p=0; In per point: p=p+1; x=xp1*equal(p,1)+xp2*equal(p,2)+xp3*equal(p,3); y=yp1*equal(p,1)+yp2*equal(p,2)+yp3*equal(p,3); where xp1, xp2, xp3, yp1, yp2 and yp3 are coordinates. Make sure n equals the number of p you use, all n higher than p snap to coords (0,0). Works in 3D as well. .:HyperNation @ winamp:. .:DeviantArt:. Thermal is now available for download at DeviantArt.
 28th June 2004, 10:29 #3 Jaak Major Dude     Join Date: Jan 2003 Location: Estonia. Posts: 851 dont use multiply, just chunks of ifs, multiplication is slow, but the ifs will be quite faster... especialy if your little scope consists of 100 points Phi = (1+sqrt(5))/2
 28th June 2004, 11:51 #4 Warrior of the Light Forum King     Join Date: Aug 2002 Location: The Netherlands Posts: 4,082 I don't think this is what he meant.. You can use px=1/w for instance for 1 pixel in width and py=1/h for 1 pixel in height. or 2/h, 3/h for two or three pixels etc. Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
 29th June 2004, 00:57 #5 horse-fly Account Closed     Join Date: Apr 2001 Posts: 2,360 I'll try what WOTL said, as it seems to be the one that would work.
 29th June 2004, 07:24 #6 Shylent Junior Member   Join Date: May 2004 Location: A Galaxy Far Far Away Posts: 19 Hmm, seriously, Jaak, in case you are right, I will need to remake quite a lot of my scopes
 29th June 2004, 07:52 #7 TomyLobo Major Dude     Join Date: Feb 2004 Location: Germany Posts: 580 you should use megabufs for those scopes then wotl: i think it was 1/(w-1) and 1/(h-1) If you can't say something nice, say something surrealistic.
 1st July 2004, 22:22 #8 Warrior of the Light Forum King     Join Date: Aug 2002 Location: The Netherlands Posts: 4,082 Why the extra -1? If screenwidth (w) is, say, 300 pixels, then 1 pixel is 1/w (1 / 300 = 0.003333333-> ). Or am I wrong? Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
 2nd July 2004, 21:10 #9 UnConeD Whacked Moderator     Join Date: Jun 2001 Posts: 2,104 1 pixel is 2/w (-1 .. 1 = 2 units), but you might need to add 1/w to coordinates to make sure you are on the center of a pixel. Same for y.
 3rd July 2004, 02:24 #10 dirkdeftly Forum King     Join Date: Jun 2001 Location: Cydonia, Mars Posts: 2,651 also, if you run into problems (as i did just recently) with points being a pixel off, avs does some wonky rounding and i *think* it turns out that avs rounds down to the nearest pixel when the value is above zero, and up if the value is below zero. so if you have a point that is at 100.5 pixels, it will round to 100, but if it's -100.5, it'll round to -100 instead of -101 the way i fixed it is just adding 1/w (1/2 pixel) to x and y. stupidgoddamnroundingerrors "guilt is the cause of more disauders than history's most obscene marorders" --E. E. Cummings
 3rd July 2004, 13:42 #11 Warrior of the Light Forum King     Join Date: Aug 2002 Location: The Netherlands Posts: 4,082 So if your screensize is 300x300 then w=h=150 and not 300?!? WTF? Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
 3rd July 2004, 16:27 #12 UnConeD Whacked Moderator     Join Date: Jun 2001 Posts: 2,104 Um no WOTL. Width in pixels = 300pixels Width in 'avs units' = 2 (from -1 to 1). 1 pixel = 2 / 300 = 2 / w
 5th July 2004, 11:19 #13 TomyLobo Major Dude     Join Date: Feb 2004 Location: Germany Posts: 580 ok 2/(w-1) pixels on screen go from 0..(w-1) whereas AVS has a coordinate range of -1..1 so to go from pixels to avs coords, you - divide by (w-1) - multiply by 2 - subtract 1 in other words xavs=xpix/(w-1)*2-1; if you have 2 pixels and want the distance, in avs coordinates: xavs1=xpix1/(w-1)*2-1; xavs2=xpix2/(w-1)*2-1; xavs2-xavs1=xpix2/(w-1)*2-1-(xpix1/(w-1)*2-1); =xpix2/(w-1)*2-xpix1/(w-1)*2; =(xpix2-xpix1)/(w-1)*2; if xpix2-xpix1 is 1 pixel then you get xavs2-xavs1=2/(w-1) same thing for y coords just with h instead of w If you can't say something nice, say something surrealistic.
 5th July 2004, 16:15 #14 Warrior of the Light Forum King     Join Date: Aug 2002 Location: The Netherlands Posts: 4,082 Okay, I get it now. Thanks Jesus loves you [yes, you] so much, he even died for you so that you will not need to die, but live forever
 6th July 2004, 04:22 #15 NemoOrange Senior Member     Join Date: Jan 2003 Location: Philadelphia, USA Posts: 135 Kinda on the same subject: I was making a scope that I wanted to move in perfect 45 degree angles. The code went something like: xm=xm+sin(mr)*speed; ym=ym+cos(mr)*speed; mr=\$PI/2*var+\$PI/4; x=xm; y=ym; For the most part, it did move in 45 degrees, but every 10 pixels or so, it would move up a pixel, then back down 10 pixels later. This sounds like what Atero was talking about. Does anyone know how to fix this?
 6th July 2004, 06:33 #16 UnConeD Whacked Moderator     Join Date: Jun 2001 Posts: 2,104 Nemo: Perhaps there are some rounding errors on the angle, in any case it's faster to just use +/- 0.707 rather than sin/cos.
 4th August 2004, 10:59 #17 vanderphunck Junior Member     Join Date: Jul 2004 Location: Finland Posts: 47 check my reply to this thread: http://forums.winamp.com/showthread....45#post1429445
 Winamp & Shoutcast Forums > AVS Pixel Placement