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

◆ grad()

fl::i32 fl::perlin_s16x16::grad ( int hash,
fl::i32 x,
fl::i32 y )
static

Definition at line 83 of file perlin_s16x16.cpp.hpp.

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

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

Referenced by pnoise2d_raw(), and fl::perlin_s16x16_simd::pnoise2d_raw_simd4_vec().

+ Here is the caller graph for this function: