FastLED 3.9.15
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 85 of file perlin_s8x8.cpp.hpp.

85 {
86 struct GradCoeff { fl::i8 cx; fl::i8 cy; };
87 constexpr GradCoeff lut[16] = {
88 { 1, 1}, {-1, 1}, { 1, -1}, {-1, -1},
89 { 1, 0}, {-1, 0}, { 1, 0}, {-1, 0},
90 { 0, 1}, { 0, -1}, { 0, 1}, { 0, -1},
91 { 1, 1}, { 0, -1}, {-1, 1}, { 0, -1},
92 };
93 const GradCoeff &g = lut[hash & 15];
94 return static_cast<fl::i16>(g.cx * x + g.cy * y);
95}
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: