Fix parameters for Simplex noise, to make sure the last octave has not a greater scale than 1

Also use a 401x401 grid instead of 400, so that there are 400 intervals
This commit is contained in:
Gael-de-Sailly 2020-04-26 16:52:40 +02:00
parent 9700e948b9
commit 49bc397718
1 changed files with 3 additions and 3 deletions

View File

@ -15,15 +15,15 @@ argc = len(sys.argv)
if argc > 1: if argc > 1:
mapsize = int(sys.argv[1]) mapsize = int(sys.argv[1])
else: else:
mapsize = 400 mapsize = 401
scale = mapsize / 2 scale = (mapsize-1) / 2
n = np.zeros((mapsize, mapsize)) n = np.zeros((mapsize, mapsize))
#micronoise_depth = 0.05 #micronoise_depth = 0.05
params = { params = {
"octaves" : int(np.log2(mapsize)), "octaves" : int(np.ceil(np.log2(mapsize-1)))+1,
"persistence" : 0.5, "persistence" : 0.5,
"lacunarity" : 2., "lacunarity" : 2.,
} }