Razaekel / noise-rs

Procedural noise generation library for Rust.
Apache License 2.0
854 stars 120 forks source link

Remove useless exponentiation in fbm by multiplying the value in the loop #310

Closed bertin0 closed 1 year ago

bertin0 commented 1 year ago

Fixes #299

PrinceOfBorgo commented 10 months ago

The fix is wrong. Multiplying attenuation by itself at each iteration produces persistence ^ (2 ^ (x + 1)) and not persistence ^ (x + 1). The fix is to multiply attenuation by self.persistance instead.

// Increase the attenuation for the next octave, to be equal to persistence ^ (x + 1)
attenuation *= self.persistence;