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

◆ inoise8_raw() [1/3]

int8_t inoise8_raw ( uint16_t x)
extern

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

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

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

Definition at line 643 of file noise.cpp.

644{
645 // Find the unit cube containing the point
646 uint8_t X = x>>8;
647
648 // Hash cube corner coordinates
649 uint8_t A = P(X);
650 uint8_t AA = P(A);
651 uint8_t B = P(X+1);
652 uint8_t BA = P(B);
653
654 // Get the relative position of the point in the cube
655 uint8_t u = x;
656
657 // Get a signed version of the above for the grad function
658 int8_t xx = ((uint8_t)(x)>>1) & 0x7F;
659 uint8_t N = 0x80;
660
661 u = EASE8( u);
662
663 int8_t ans = lerp7by8(grad8(P(AA), xx), grad8(P(BA), xx - N), u);
664
665 return ans;
666}
int x
Definition Audio.ino:71
static int8_t grad8(uint8_t hash, int8_t x, int8_t y, int8_t z)
Definition noise.cpp:183
#define P(x)
Reads a single byte from the p array.
Definition noise.cpp:25
static int8_t lerp7by8(int8_t a, int8_t b, fract8 frac)
Definition noise.cpp:298

References grad8(), lerp7by8(), P, and x.

+ Here is the call graph for this function: