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 / Fractal terrian program making 200-year old spike pits.

Author
Message
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 16th Jul 2004 12:32
I set every point on the heightmap to -1 to differenciate between points set and points not set. then I put random heights on the heightmap from 0,0 to currently 32,32 using a for/next loop and stepping by half the map size, so 9 height points. The program then is supposed to step accross the map at half intervals, check to see if the current point is at -1, if it is, take the average of all points at the current step distance x,y or both away that aren't at -1, then input the average into it's current square. Once it completes a map, it divides both distances it's stepping by by /2 and goes again until it's done the map at 1,1 intervals.

So, can someone take a look at the code and tell me what I'm doing wrong, please? I've been at this for a while.

Cheese!
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 16th Jul 2004 13:40
I was given this function a while back which smooths a matrix.
the paramters of the function show what to do in order to use it.



If no-one gives your an answer to a question you have asked, consider:- Is your question clear.- Did you ask nicely.- Are you showing any effort to solve the problem yourself
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Jul 2004 17:49
I have no idea what you're talking about. But if smoothing the matrix out is what you want, then here's a routine I made just for that.



The problem with indi's is that its not averaged out properly. After a point's new averaged height is configured, it's written immediately back to the height data. More points will use that when their heights are averaged. Therefore, each point ends up being averaged with not the original heights, but with averaged height values. To fix this, you have an array of all original heights. Each new averaged height is configured from that array, and the result can be written to the matrix structure without worry of overwriting needed data. Also, his routine doesn't affect edge tiles, but that's probably just a preference.(which also minimizes code)

"eureka" - Archimedes
Narf The Mouse
20
Years of Service
User Offline
Joined: 16th Jul 2004
Location:
Posted: 25th Jul 2004 12:36
Thanks. I had an allergy attack and kept forgetting about this. That does solve the spikes, but I would like to know why there are spikes.

Cheese!

Login to post a reply

Server time is: 2024-11-16 01:24:36
Your offset time is: 2024-11-16 01:24:36