Archived

This topic is now archived and is closed to further replies.

Water article

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wrote a small program that creates the waves in C++. The part for the waves looks like this:

code:

void CalculateWaves (void)
{
WORD x;
WORD y;
short tmp_value;

for (y = 2; y < 198; y++)
{
for (x = 2; x < 198; x++)
{
tmp_value = ( WaveMap[CT][x-1][y] +
WaveMap[CT][x-2][y] +
WaveMap[CT][x+1][y] +
WaveMap[CT][x+2][y] +
WaveMap[CT][x][y-1] +
WaveMap[CT][x][y-2] +
WaveMap[CT][x][y+1] +
WaveMap[CT][x][y+2] +
WaveMap[CT][x-1][y-1] +
WaveMap[CT][x+1][y-1] +
WaveMap[CT][x-1][y+1] +
WaveMap[CT][x+1][y+1]
) / 6 - WaveMap[NW][x][y];
tmp_value = tmp_value / 1.1;
WaveMap [NW][x][y] = tmp_value;
}
}
char old_ct = CT; // CT und NW vertauschen
CT = NW;
NW = old_ct;
}


[This message has been edited by Melo (edited November 25, 1999).]

Share this post


Link to post
Share on other sites