Diamond Square algorithm

Started by
0 comments, last by AndyPandyV2 15 years, 8 months ago
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!
Advertisement
Why not use noise instead and just blend the value toward 0 in those spots where your MustBeZero array says to do so.

This topic is closed to new replies.

Advertisement