MCPcopy Create free account
hub / github.com/FastLED/FastLED / geti16

Method geti16

src/fl/math/wave/wave_simulation.cpp.hpp:86–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86i16 WaveSimulation2D::geti16(fl::size x, fl::size y) const {
87 if (!has(x, y))
88 return 0;
89 i32 sum = 0;
90 u8 mult = fl::max(1, mMultiplier);
91 for (u32 j = 0; j < mult; ++j) {
92 for (u32 i = 0; i < mult; ++i) {
93 u32 xx = x * mult + i;
94 u32 yy = y * mult + j;
95 i32 pt = mSim->geti16(xx, yy);
96 if (mUseChangeGrid) {
97 // i32 ch_pt = mChangeGrid[(yy * mMultiplier) + xx];
98 i32 ch_pt = mChangeGrid(xx, yy);
99 if (ch_pt != 0) { // we got a hit.
100 sum += ch_pt;
101 } else {
102 sum += pt;
103 }
104 } else {
105 sum += pt;
106 }
107 }
108 }
109 i16 out = static_cast<i16>(sum / (mult * mult));
110 return out;
111}
112
113i16 WaveSimulation2D::geti16Previous(fl::size x, fl::size y) const {
114 if (!has(x, y))

Callers 1

FL_TEST_FILEFunction · 0.45

Calls 2

hasFunction · 0.85
maxFunction · 0.85

Tested by

no test coverage detected