| 40 | } |
| 41 | |
| 42 | CRGB sampleNearest(const CRGB *grid, const XYMap &xyMap, float x, float y) { |
| 43 | int xi = static_cast<int>(x + 0.5f); // Round to nearest |
| 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 | } |
| 49 | |
| 50 | } // namespace fl |
no test coverage detected