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

◆ at_splat_extrapolate()

Tile2x2_u8 fl::Corkscrew::at_splat_extrapolate ( float i) const
private

Definition at line 132 of file corkscrew.cpp.

132 {
133 if (i >= mNumLeds) {
134 // Handle out-of-bounds access, possibly by returning a default
135 // Tile2x2_u8
136 FASTLED_ASSERT(false, "Out of bounds access in Corkscrew at_splat: "
137 << i << " size: " << mNumLeds);
138 return Tile2x2_u8();
139 }
140
141 // Use the splat function to convert the vec2f to a Tile2x2_u8
142 float i_floor = floorf(i);
143 float i_ceil = ceilf(i);
144 if (ALMOST_EQUAL_FLOAT(i_floor, i_ceil)) {
145 // If the index is the same, just return the splat of that index
146 vec2f position = at_no_wrap(static_cast<fl::u16>(i_floor));
147 return splat(position);
148 } else {
149 // Interpolate between the two points and return the splat of the result
150 vec2f pos1 = at_no_wrap(static_cast<fl::u16>(i_floor));
151 vec2f pos2 = at_no_wrap(static_cast<fl::u16>(i_ceil));
152 float t = i - i_floor;
153 vec2f interpolated_pos = map_range(t, 0.0f, 1.0f, pos1, pos2);
154 return splat(interpolated_pos);
155 }
156}
fl::u16 mNumLeds
Definition corkscrew.h:230
vec2f at_no_wrap(fl::u16 i) const
Definition corkscrew.cpp:98
static uint32_t t
Definition Luminova.h:54
#define ALMOST_EQUAL_FLOAT(a, b)
Definition math_macros.h:63
Tile2x2_u8 splat(vec2f xy)
"Splat" as in "splat pixel rendering" takes a pixel value in float x,y coordinates and "splats" it in...
Definition splat.cpp:14
vec2< float > vec2f
Definition geometry.h:333

References ALMOST_EQUAL_FLOAT, at_no_wrap(), mNumLeds, fl::splat(), and t.

Referenced by calculateTileAtWrap().

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