Revert "we really should be using round, but why is it worse?"

This reverts commit 81f6de2a8f.
This commit is contained in:
Henry Schimke
2022-10-11 08:12:25 -05:00
parent 17c2fc3a79
commit b43ef07382
4 changed files with 4 additions and 4 deletions

View File

@@ -2363,7 +2363,7 @@ impl GridSampler for DefaultGridSampler {
let mut x = 0; let mut x = 0;
while x < max { while x < max {
// for (int x = 0; x < max; x += 2) { // for (int x = 0; x < max; x += 2) {
if image.get(points[x].round() as u32, points[x + 1].round() as u32) { if image.get(points[x].floor() as u32, points[x + 1].floor() as u32) {
// Black(-ish) pixel // Black(-ish) pixel
bits.set(x as u32 / 2, y); bits.set(x as u32 / 2, y);
} }

View File

@@ -290,7 +290,7 @@ impl AlignmentPatternFinder {
let centerJ = Self::centerFromEnd(stateCount, j); let centerJ = Self::centerFromEnd(stateCount, j);
let centerI = self.crossCheckVertical( let centerI = self.crossCheckVertical(
i, i,
centerJ.round() as u32, centerJ.floor() as u32,
2 * stateCount[1], 2 * stateCount[1],
stateCountTotal, stateCountTotal,
); );

View File

@@ -92,7 +92,7 @@ impl FinderPattern {
combinedX, combinedX,
combinedY, combinedY,
combinedModuleSize, combinedModuleSize,
combinedCount.round() as usize, combinedCount.floor() as usize,
) )
} }
} }

View File

@@ -620,7 +620,7 @@ impl FinderPatternFinder {
return (((fnp.getX() - center.getX().abs()) return (((fnp.getX() - center.getX().abs())
- (fnp.getY() - center.getY()).abs()) - (fnp.getY() - center.getY()).abs())
/ 2.0) / 2.0)
.round() as u32; .floor() as u32;
} }
} }
} }