Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken for negative inputs in 2D #3

Open
GoogleCodeExporter opened this issue Mar 31, 2016 · 1 comment
Open

Broken for negative inputs in 2D #3

GoogleCodeExporter opened this issue Mar 31, 2016 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Attempt to generate any noise given negative inputs (in 2D and 3D)

What is the expected output? What do you see instead?
Noise is expected, an out of bounds exception is thrown instead.

What version of the product are you using? On what operating system?
1.01, Windows 7

Please provide any additional information below.
It's simply because of line 107 and 108, just replace:

int ii = i % 256;
int jj = j % 256;

with 

int ii = i & 0xff;
int jj = j & 0xff;

or

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

and it works as expected. This is because of this: 
http://stackoverflow.com/questions/11720656/modulo-operation-with-negative-numbe
rs

It's done correctly in 3 dimensions, however. (it uses the Mod function already 
in the code that addresses the issue in the above link)

Original issue reported on code.google.com by [email protected] on 26 Apr 2014 at 3:06

@GoogleCodeExporter
Copy link
Author

Correction: There is no problem in 3D, only 2D.

Original comment by [email protected] on 26 Apr 2014 at 3:07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant