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

Negative input values result in invalid noise result #1

Closed
SenneW-2158088 opened this issue Apr 15, 2024 · 1 comment
Closed

Negative input values result in invalid noise result #1

SenneW-2158088 opened this issue Apr 15, 2024 · 1 comment

Comments

@SenneW-2158088
Copy link

When using the function like:

  for (int x = -2; x < 2; x++) {

    for (int z = -2; z < 2; z++) {
      std::cout << "("<< x << ", " << z << ")" << std::endl;
      std::cout << db::perlin(x * 0.2f, z * 0.2f) << std::endl; 
    }
    std::cout << std::endl;
  }

this results in very high output noise values when there is a negative number involved:

(-2, -2)
-1.11151e+28
(-2, -1)
-1.10544e+28
(-2, 0)
1.68817e+15
(-2, 1)
1.39458e+15

(-1, -2)
-1.10803e+28
(-1, -1)
-1.10199e+28
(-1, 0)
1.68027e+15
(-1, 1)
1.38806e+15

(0, -2)
1.68158e+15
(0, -1)
1.67371e+15
(0, 0)
0
(0, 1)
-0.046336

(1, -2)
1.68227e+15
(1, -1)
1.67439e+15
(1, 0)
0.188416
(1, 1)
0.128483

@daniilsjb
Copy link
Owner

Hello! Sorry for not dealing with this issue sooner, I had busy several months. I fixed the problem, it was a small mistake specific to the 2D implementation of the noise. I decided to play around with adding an interactive visualization of the algorithm and, indeed, the image was a complete mess for negative coordinates. Thanks for noticing this!

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

No branches or pull requests

2 participants