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

◆ grad() [1/4]

static fl::i32 grad ( fl::u8 hash,
fl::i32 x )
static

Definition at line 75 of file simplex.cpp.hpp.

75 {
76 fl::u8 h = hash & 15;
77 fl::i32 grad = 1 + (h&7); // Gradient value 1.0, 2.0, ..., 8.0
78 if ((h&8) != 0) {
79 grad = -grad; // Set a random sign for the gradient
80 }
81 return grad * x; // Multiply the gradient with the distance (integer * 0.12 = *.12)
82}
int x
Definition simple.h:92
unsigned char u8
Definition stdint.h:131
static fl::i32 grad(fl::u8 hash, fl::i32 x) FL_NO_EXCEPT

References FL_NO_EXCEPT, grad(), and x.

Referenced by grad(), snoise16(), snoise16(), snoise16(), and snoise16().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: