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 90 of file simplex.cpp.

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

References x, y, and z.