Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Smooth matrix code please?

Author
Message
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 1st Sep 2003 19:27
could somobdy post some matrix code that would create a random but smooth matrix. or if not random at least a matrix with serveral bumps in it.

Ill start the ball rolling

Make matrix 1,1000,1000,30,30

>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 1st Sep 2003 19:35 Edited at: 1st Sep 2003 19:36
To smooth a matrix, go through each tile and take the average height of the tiles around it.

To get a few hills in, start off with a big bump in the middle

pseudo-code:


The more you run the code the lower and smoother the matrix will become.

Theres no place like 127.0.0.1
There are 10 people in this world, those who understand binary and those who don't
Bus station = where bus stops. Train station = where train stops. Workstation = ?
ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 1st Sep 2003 20:09 Edited at: 1st Sep 2003 20:09
cool, i made a function using your psuedo code david


thats an example program


thats just the function
all you need to do is make a matrix, randomize it then smooth it with my function.


David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 1st Sep 2003 20:22 Edited at: 1st Sep 2003 20:22
Looks very nice after being smoothed a few times (best around 3). Well done

Theres no place like 127.0.0.1
There are 10 people in this world, those who understand binary and those who don't
Bus station = where bus stops. Train station = where train stops. Workstation = ?
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 1st Sep 2003 21:16
Great guys thx
WOOOOOOOOOOOOOOOOOOOOOOOOOOO

>>TerraByte. Putting the Byte back into Terragramming<< If my post has less than 20 typos then it wasnt me who wrote it!
indi
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 2nd Sep 2003 10:47
red-eye and dave earnt a credit in DT for this good work was applied to the editor.




http://www.lunarpixel.com
It's already tomorrow in Australia

Login to post a reply

Server time is: 2026-07-23 20:05:08
Your offset time is: 2026-07-23 20:05:08