pvigier / perlin-numpy

A fast and simple perlin noise generator using numpy
https://pvigier.github.io/2018/06/13/perlin-noise-numpy.html
MIT License
304 stars 50 forks source link

ValueError at high Octaves & Lacunarity #8

Open AyrtonB opened 3 years ago

AyrtonB commented 3 years ago

When using larger octaves and lacunarity (e.g. 2 & 3 respectively) the following error occurs in perlin2d

ValueError: operands could not be broadcast together with shapes (1024,1024,2) (1023,1023,2)

At the line

n00 = np.sum(np.dstack((grid[:,:,0] , grid[:,:,1] )) * g00, 2)

I believe this is because the delta tuple doesnt consider what happens when there's a remainder from shape/resolution

AyrtonB commented 3 years ago

Have added a check for valid resolutions in #7