swap point_f and point functions

This commit is contained in:
Henry Schimke
2023-05-04 14:50:32 -05:00
parent 80f06ecb3c
commit 3fc068f49b
38 changed files with 210 additions and 217 deletions

View File

@@ -18,7 +18,7 @@ use std::collections::HashMap;
use crate::{
common::{BitMatrix, DecoderRXingResult, DetectorRXingResult, Result},
point, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, Point,
point_f, BarcodeFormat, Binarizer, DecodeHintType, DecodeHintValue, Exceptions, Point,
RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader,
};
@@ -218,7 +218,7 @@ impl DataMatrixReader {
let iOffset = top + y as f32 * moduleSize as f32;
for x in 0..matrixWidth {
// for (int x = 0; x < matrixWidth; x++) {
if image.get_point(point(left + x as f32 * moduleSize as f32, iOffset)) {
if image.get_point(point_f(left + x as f32 * moduleSize as f32, iOffset)) {
bits.set(x, y);
}
}

View File

@@ -19,7 +19,7 @@ use crate::{
detector::WhiteRectangleDetector, BitMatrix, DefaultGridSampler, GridSampler,
Quadrilateral, Result,
},
point, Exceptions, Point,
point_f, Exceptions, Point,
};
use super::DatamatrixDetectorResult;
@@ -103,7 +103,7 @@ impl<'a> Detector<'_> {
fn shiftPoint(p: Point, to: Point, div: u32) -> Point {
let x = (to.x - p.x) / (div as f32 + 1.0);
let y = (to.y - p.y) / (div as f32 + 1.0);
point(p.x + x, p.y + y)
point_f(p.x + x, p.y + y)
}
fn moveAway(p: Point, fromX: f32, fromY: f32) -> Point {
@@ -122,7 +122,7 @@ impl<'a> Detector<'_> {
y += 1.0;
}
point(x, y)
point_f(x, y)
}
/**
@@ -231,11 +231,11 @@ impl<'a> Detector<'_> {
trTop = self.transitionsBetween(pointAs, pointD);
trRight = self.transitionsBetween(pointCs, pointD);
let candidate1 = point(
let candidate1 = point_f(
pointD.x + (pointC.x - pointB.x) / (trTop as f32 + 1.0),
pointD.y + (pointC.y - pointB.y) / (trTop as f32 + 1.0),
);
let candidate2 = point(
let candidate2 = point_f(
pointD.x + (pointA.x - pointB.x) / (trRight as f32 + 1.0),
pointD.y + (pointA.y - pointB.y) / (trRight as f32 + 1.0),
);
@@ -336,10 +336,10 @@ impl<'a> Detector<'_> {
let sampler = DefaultGridSampler::default();
let dst = Quadrilateral::new(
point(0.5, 0.5),
point(dimensionX as f32 - 0.5, 0.5),
point(dimensionX as f32 - 0.5, dimensionY as f32 - 0.5),
point(0.5, dimensionY as f32 - 0.5),
point_f(0.5, 0.5),
point_f(dimensionX as f32 - 0.5, 0.5),
point_f(dimensionX as f32 - 0.5, dimensionY as f32 - 0.5),
point_f(0.5, dimensionY as f32 - 0.5),
);
let src = Quadrilateral::new(topRight, topLeft, bottomRight, bottomLeft);

View File

@@ -22,7 +22,7 @@ use crate::{
zxing_cpp_detector::{util::intersect, BitMatrixCursorTrait},
DatamatrixDetectorResult,
},
point,
point_f,
qrcode::encoder::ByteMatrix,
Exceptions, Point,
};
@@ -217,10 +217,10 @@ fn Scan(
let grid_sampler = DefaultGridSampler::default();
// let transform = PerspectiveTransform::quadrilateralToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3, x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p);
let dst = Quadrilateral::new(
point(0.0, 0.0),
point(dimT as f32, 0.0),
point(dimT as f32, dimR as f32),
point(0.0, dimR as f32),
point_f(0.0, 0.0),
point_f(dimT as f32, 0.0),
point_f(dimT as f32, dimR as f32),
point_f(0.0, dimR as f32),
);
let src = sourcePoints;