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

◆ grad()

FASTLED_FORCE_INLINE fl::i32 fl::perlin_q16::grad ( int hash,
fl::i32 x,
fl::i32 y )
staticprivate

Definition at line 86 of file perlin_q16.cpp.hpp.

86 {
87 struct GradCoeff { fl::i8 cx; fl::i8 cy; };
88 constexpr GradCoeff lut[16] = {
89 { 1, 1}, {-1, 1}, { 1, -1}, {-1, -1},
90 { 1, 0}, {-1, 0}, { 1, 0}, {-1, 0},
91 { 0, 1}, { 0, -1}, { 0, 1}, { 0, -1},
92 { 1, 1}, { 0, -1}, {-1, 1}, { 0, -1},
93 };
94 const GradCoeff &g = lut[hash & 15];
95 return g.cx * x + g.cy * y;
96}
signed char i8
Definition stdint.h:130

References FASTLED_FORCE_INLINE, fl::x, and fl::y.

Referenced by pnoise2d_raw().

+ Here is the caller graph for this function: