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 505 of file noise.cpp.

505 {
506 int32_t ans = inoise16_raw(x,y);
507 ans = ans + 17308L;
508 uint32_t pan = ans;
509 // pan = (ans * 242L) >> 7. That's the same as:
510 // pan = (ans * 484L) >> 8. And this way avoids a 7X four-byte shift-loop on AVR.
511 // Identical math, except for the highest bit, which we don't care about anyway,
512 // since we're returning the 'middle' 16 out of a 32-bit value anyway.
513 pan *= 484L;
514 return (pan>>8);
515
516 // return (uint32_t)(((int32_t)inoise16_raw(x,y)+(uint32_t)17308)*242)>>7;
517 // return scale16by8(inoise16_raw(x,y)+17308,242)<<1;
518}
int y
Definition Audio.ino:72
int x
Definition Audio.ino:71
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:318

References inoise16_raw(), x, and y.

+ Here is the call graph for this function: