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

Change Octaves to be u8 instead of usize

Open Razaekel opened this issue 2 years ago • 2 comments

u8 allows up to 256 octaves, but most of the time, the number of octaves will probably be less than 10. Don't need full pointer width to store the number of octaves, hence the move to u8.

Razaekel avatar Jul 11 '21 03:07 Razaekel

Is there some other limitation in the library making 256 convenient? Your applications may only use 10 octaves, but I've written code that's used more than 256. I'm not sure the purpose of artificially restricting this, it sure as heck isn't performance.

Cazadorro avatar Jul 11 '21 16:07 Cazadorro

Is there some other limitation in the library making 256 convenient? Your applications may only use 10 octaves, but I've written code that's used more than 256. I'm not sure the purpose of artificially restricting this, it sure as heck isn't performance.

Time to compute the fractal noisefn is linear in the number of octaves. Besides, I'd like to change it to a fixed size instead of usize. If you do need more than 256, I don't have an issue making it u16 (65,535 octaves) or u32 instead( ~4.3 billion octaves).

Razaekel avatar Jul 11 '21 18:07 Razaekel