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

4-dimensional Perlin always returns 1 #277

Open
camilchp opened this issue Nov 27, 2021 · 1 comment
Open

4-dimensional Perlin always returns 1 #277

camilchp opened this issue Nov 27, 2021 · 1 comment

Comments

@camilchp
Copy link

use noise::{NoiseFn, Perlin};

fn main () {
    let perlin = Perlin::new();
    let val = perlin.get([0.4, 0.7, 0.5, 0.5]);
    println!("{}", val)
}

This prints 1 regardless of parameters passed to get.

@bsurmanski
Copy link
Contributor

I recently created a unit test for the core perlin functions:
https://github.com/bsurmanski/noise-rs/blob/4caa1145eac4adb6a4d46c5b9fd498e59b34e2d1/src/core/perlin.rs#L408

I get a range between -1 and 1.

I tried running the exact code provided, and it returned 1.0. But, passing a different point, [0.1, 0.2, 0.5, 0.5], returned 0.114. Passing a different seed to Perlin will also return something not 1.0.

Perhaps you forgot to re-compile?

I tested this on the develop branch.

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