noise-rs icon indicating copy to clipboard operation
noise-rs copied to clipboard

4-dimensional Perlin always returns 1

Open camilchp opened this issue 3 years ago • 1 comments

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.

camilchp avatar Nov 27 '21 18:11 camilchp

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.

bsurmanski avatar Jan 04 '22 02:01 bsurmanski