Nearest-neighbor sample from a 2D CRGB grid.
Definition at line 42 of file sample.cpp.hpp.
42 {
43 int xi =
static_cast<int>(
x + 0.5f);
44 int yi =
static_cast<int>(
y + 0.5f);
45 xi =
max(0,
min(xi,
static_cast<int>(
xyMap.getWidth()) - 1));
46 yi =
max(0,
min(yi,
static_cast<int>(
xyMap.getHeight()) - 1));
47 return grid[
xyMap.mapToIndex(xi, yi)];
48}
FL_DISABLE_WARNING_PUSH U constexpr common_type_t< T, U > min(T a, U b) FL_NOEXCEPT
constexpr common_type_t< T, U > max(T a, U b) FL_NOEXCEPT
References max(), min(), x, xyMap, and y.
Referenced by sample().