# Wu particles not working right

This topic is 4976 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Heres the deal. I have been trying out some old-school graphics programming using TinyPTC (Check it out here). I am trying to just get some basic stuff working, right now I am trying to get wu particles working (as well as my initials spelled with dots waving in a sine wave). Information on this is hard to find, I am using this site pretty much. I am using the algorithm directly with less than optimal results. The exe can be found here zipped It is actually supposed to be my initials, though it just looks like a moving mass of dots. Anyway, the top half looks great, but the bottom dots looks pretty messed up and I have no idea why.
void plotwu(float wx, float wy, int wb)
{
int x, y;
float fx, fy;
int btl, btr, bbl, bbr;

x = int(wx);
y = int(wy);
fx = wx - x;
fy = wy - y;

btl = (1-fx) * (1-fy) * wb;
btr =  (fx)  * (1-fy) * wb;
bbl = (1-fx) *  (fy)  * wb;
bbr =  (fx)  *  (fy)  * wb;

plot(x,   y  ,rgb(btl,btl,btl));
plot(x+1, y  ,rgb(btr,btr,btr));
plot(x,   y+1,rgb(bbl,bbl,bbl));
plot(x+1, y+1,rgb(bbr,bbr,bbr));
}


This is the function, and if you want me to post more code, feel free. (I'm sure this is a stupid mistake, but I will never be able to find it)

##### Share on other sites
I have been trying out different things, and I figured out it has nothing to do with negative numbers (I thought maybe the algorithm could only deal with positive screen coords). However, the problem fails to present itself when the text is stationary, so the problem must be with the movement.
ypos = 54;//stufffor(y = 0; y < 9; ++y){    ypos -= 4;    xpos = x_offset;    for(x = 0; x < 22; ++x)    {        if(text[y][x] == 1)        plotwu(xpos, ypos, 255);        xpos += 6;    }  		}//later in the codex_offset += 100*frame_time;if(x_offset > 160)    x_offset = -182

anyway, my method of doing movement is probably a bad way, but I don't see how it would mess up the plotwu function. I think the problem would have to lie somewhere in the code I posted.

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631706
• Total Posts
3001833
×