WardBenjamin / SimplexNoise

C# Simplex Noise (1D, 2D, 3D). Supports arbitrary sizes and scales.
BSD 3-Clause "New" or "Revised" License
160 stars 38 forks source link

2D Noise perm[ii + 1] out of bounds #2

Closed GoogleCodeExporter closed 6 years ago

GoogleCodeExporter commented 9 years ago
I believe you forgot to switch out the "%"-operator for the Mod(,) operator in 
the 2d-Generate function as you did in the 3d-Generate. The Way it is now 
doesnt work with negative coordinates.

Thx for putting these up here btw :)

Original issue reported on code.google.com by ferurkel...@googlemail.com on 28 Oct 2013 at 2:15

GoogleCodeExporter commented 9 years ago
Having the same issue, is that how you fixed it?

Switched from method 'Generate(float x, float y)':
int ii = i % 256;
int jj = j % 256;

With:
int ii = Mod(i, 256);
int jj = Mod(j, 256);

This is beyond me, but what you said seems to work! So I assume it's all good 
to go. Hopefully this can be updated, this is a truly great bit of code!

Original comment by will.mj....@googlemail.com on 19 Jun 2014 at 12:33

WardBenjamin commented 6 years ago

Closing in favor of #3. Same issue.