Sphere map test

I got back to my map generating program. I decided to check my algorithm for making maps on a sphere. I was always a little concerned about it. A big part of the operation is based off of finding a random point on the surface of a sphere.

The way I was doing it was based off of the methodology of the rest of the algorithm. Essentially I was taking a random point in a cube and projecting that on to the sphere in question. For the most part that is good. But is it really random? I had a theory that it wasn’t, so I devised a test. I ran the program again, but this time I took out the random element. I went through almost every point within the cube and used that as a projection. Then it generated a map from using all of those points. If my random method was good, then the map would be completely uniform. There would be no mountains and no oceans. But that wasn’t the case. Instead the map looked like this:


Sphere map test
Originally uploaded by ad_havoc

White indicates higher elevations and black is lower. So we can see that there is clumping at what would be the corners of the cube and along the edges. Just as I suspected.
So now I have to use a different method.

I can’t just use random latitude and longitude because that would cause clumping at the poles. (If you think about it, the north and south poles would be just as likely to be chosen as the equator, despite being vastly different in size.)
However, I think I can use something like it. I just have to compensate for it. For this I will need to try and remember how to use calculus to come up with a formula. Finally university math is going to be useful.