• Advertisement
Sign in to follow this  

Diamond Square algorithm

This topic is 3455 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

So I've been looking all over the internet trying to find straightforward C code for the diamond square algorithm. I would settle for an explanation that goes into enough depth. Here's what I am trying to do. I have a height map of floats float heightMap[33][33]; I also have a boolean array bool mustBeZero[33][33]; I want to run the diamond square algorithm (also known as the midpoint displacement algorithm) where the height map at every true mustBeZero location is seeded to zero (and thus zero will be used in averaging). Most of the code out there is unreadable, and the tutorial pages don't go into enough detail for me to follow through with my idea. Please help!

Share this post


Link to post
Share on other sites
Advertisement
Why not use noise instead and just blend the value toward 0 in those spots where your MustBeZero array says to do so.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement