Strange results with perlin noise
temiaj opened this issue · comments
Hi, I'm new to rust and experimenting with perlin noise. With a little test program based on the example I get strange results from perlin noise:
`use noise::{NoiseFn, Perlin, Seedable};
fn main() {
let perlin = Perlin::new(1);
println!("{}", perlin.get([42.4, 37.7])); // => -0.23845001564978627
println!("{}", perlin.get([0.0, 0.0])); // => 0
println!("{}", perlin.get([1.0, 1.0])); // => 0
println!("{}", perlin.get([10.0, 10.0])); // => 0
println!("{}", perlin.get([0.00001, 0.0])); // => 0.000014142135637872595
}`
Is that the intended behaviour? Am I doing something wrong?
Yep, perlin noise always returns 0 on integer values. If you're feeding it coordinates from an integer grid people usually apply some scale factor (division) to their coordinates to make them not all be whole numbers.