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

◆ grad() [3/4]

static int32_t grad ( uint8_t hash,
int32_t x,
int32_t y,
int32_t z )
static

Definition at line 86 of file simplex.cpp.

86 {
87 int32_t h = hash & 15; // Convert low 4 bits of hash code into 12 simple
88 int32_t u = h < 8 ? x : y; // gradient directions, and compute dot product.
89 int32_t v = h < 4 ? y : (h == 12 || h == 14 ? x : z); // Fix repeats at h = 12 to 15
90 return ((h&1) != 0 ? -u : u) + ((h&2) != 0 ? -v : v);
91}
uint32_t z[NUM_LAYERS]
Definition Fire2023.ino:82
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81

References x, y, and z.