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

547{
548 // Find the unit cube containing the point
549 uint8_t X = x>>16;
550
551 // Hash cube corner coordinates
552 uint8_t A = P(X);
553 uint8_t AA = P(A);
554 uint8_t B = P(X+1);
555 uint8_t BA = P(B);
556
557 // Get the relative position of the point in the cube
558 uint16_t u = x & 0xFFFF;
559
560 // Get a signed version of the above for the grad function
561 int16_t xx = (u >> 1) & 0x7FFF;
562 uint16_t N = 0x8000L;
563
564 u = EASE16(u);
565
566 int16_t ans = LERP(grad16(P(AA), xx), grad16(P(BA), xx - N), u);
567
568 return ans;
569}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
#define P(x)
Reads a single byte from the p array.
Definition noise.cpp:51
static int16_t grad16(uint8_t hash, int16_t x, int16_t y, int16_t z)
Definition noise.cpp:133

References grad16(), P, and x.

+ Here is the call graph for this function: