FastLED 3.9.15
Loading...
Searching...
No Matches

◆ inoise16() [2/4]

uint16_t inoise16 ( uint32_t x,
uint32_t y )
extern

16-bit, fixed point implementation of Perlin's noise.

See also
inoise16_raw()
Returns
scaled noise value as an unsigned integer, 0-65535
Parameters
xx-axis coordinate on noise map (1D)
yy-axis coordinate on noise map (2D)

Definition at line 531 of file noise.cpp.

531 {
532 int32_t ans = inoise16_raw(x,y);
533 ans = ans + 17308L;
534 uint32_t pan = ans;
535 // pan = (ans * 242L) >> 7. That's the same as:
536 // pan = (ans * 484L) >> 8. And this way avoids a 7X four-byte shift-loop on AVR.
537 // Identical math, except for the highest bit, which we don't care about anyway,
538 // since we're returning the 'middle' 16 out of a 32-bit value anyway.
539 pan *= 484L;
540 return (pan>>8);
541
542 // return (uint32_t)(((int32_t)inoise16_raw(x,y)+(uint32_t)17308)*242)>>7;
543 // return scale16by8(inoise16_raw(x,y)+17308,242)<<1;
544}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81
int16_t inoise16_raw(uint32_t x, uint32_t y, uint32_t z)
16-bit, fixed point implementation of Perlin's noise without scaling.
Definition noise.cpp:344

References inoise16_raw(), x, and y.

+ Here is the call graph for this function: