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

◆ inoise16_raw() [1/4]

int16_t inoise16_raw ( uint32_t x)
extern

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

Coordinates are 16.16 fixed point values, 32 bit integers with integral coordinates in the high 16-bits and fractional in the low 16-bits.

Returns
unscaled noise value as a signed integer, roughly -18k to 18k
Parameters
xx-axis coordinate on noise map (1D)

Definition at line 520 of file noise.cpp.

521{
522 // Find the unit cube containing the point
523 uint8_t X = x>>16;
524
525 // Hash cube corner coordinates
526 uint8_t A = P(X);
527 uint8_t AA = P(A);
528 uint8_t B = P(X+1);
529 uint8_t BA = P(B);
530
531 // Get the relative position of the point in the cube
532 uint16_t u = x & 0xFFFF;
533
534 // Get a signed version of the above for the grad function
535 int16_t xx = (u >> 1) & 0x7FFF;
536 uint16_t N = 0x8000L;
537
538 u = EASE16(u);
539
540 int16_t ans = LERP(grad16(P(AA), xx), grad16(P(BA), xx - N), u);
541
542 return ans;
543}
int x
Definition Audio.ino:71
#define P(x)
Reads a single byte from the p array.
Definition noise.cpp:25
static int16_t grad16(uint8_t hash, int16_t x, int16_t y, int16_t z)
Definition noise.cpp:107

References grad16(), P, and x.

+ Here is the call graph for this function: