Fix integration area = 0 for a led

Former-commit-id: b365c4c9605a84ea6b7f88043f6f9c70b7122931
This commit is contained in:
johan 2014-05-06 22:02:40 +02:00
parent 2d16d369a3
commit d50b46bda2

View File

@ -35,15 +35,16 @@ ImageToLedsMap::ImageToLedsMap(
// skip leds without area
if ((led.maxX_frac-led.minX_frac) < 1e-6 || (led.maxY_frac-led.minY_frac) < 1e-6)
{
mColorsMap.emplace_back();
continue;
}
// Compute the index boundaries for this led
unsigned minX_idx = xOffset + unsigned(std::round(actualWidth * led.minX_frac));
unsigned maxX_idx = xOffset + unsigned(std::round(actualWidth * led.maxX_frac));
unsigned minY_idx = yOffset + unsigned(std::round(actualHeight * led.minY_frac));
unsigned maxY_idx = yOffset + unsigned(std::round(actualHeight * led.maxY_frac));
// make sure that the area is at least a single led large
minX_idx = std::min(minX_idx, xOffset + actualWidth - 1);
if (minX_idx == maxX_idx)