Tweaking some constants

This commit is contained in:
Dominik Moritz Roth 2023-09-07 21:07:25 +02:00
parent 67db53e4a9
commit ad6b5fe191

View File

@ -103,15 +103,15 @@ class Perlin_Noise():
self.octave = octave self.octave = octave
self.magic = 3.141592653589 # Axis offset, should be (kinda) irrational self.magic = 3.141592653589 # Axis offset, should be (kinda) irrational
# We want to genrate samples, that approx ~N(0,1) # We want to genrate samples, that approx ~N(0,1)
self.normal_factor = 14/99 self.normal_factor = 14.99
self.clear_cache_every = 1024 self.clear_cache_every = 128
self.reset() self.reset()
def __call__(self, shape=None): def __call__(self, shape=None):
if shape == None: if shape == None:
shape = self.known_shape shape = self.known_shape
self.index += 1 self.index += 1
noise = [self.noise([self.index*self.scale, self.magic*a]) / self.normal_factor noise = [self.noise([self.index*self.scale, self.magic*(1+a)]) / self.normal_factor
for a in range(shape[-1])] for a in range(shape[-1])]
if self.index % self.clear_cache_every == 0: if self.index % self.clear_cache_every == 0:
self.noise.cache = {} self.noise.cache = {}