FastLED 3.10.8
Loading...
Searching...
No Matches

◆ grad()

FASTLED_FORCE_INLINE fl::i16 fl::perlin_s8x8::grad ( int hash,
fl::i16 x,
fl::i16 y )
staticprivate

Definition at line 86 of file perlin_s8x8.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 static_cast<fl::i16>(g.cx * x + g.cy * y);
96}
InputGamut g
Definition rgbw.h:125
signed char i8
Definition stdint.h:130

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