mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 12:22:34 +00:00
swap point_f and point functions
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, Result},
|
||||
point, Exceptions, Point,
|
||||
point_f, Exceptions, Point,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -178,27 +178,27 @@ impl<'a> MonochromeRectangleDetector<'_> {
|
||||
if lastRange[0] < centerX {
|
||||
if lastRange[1] > centerX {
|
||||
// straddle, choose one or the other based on direction
|
||||
return Ok(point(
|
||||
return Ok(point_f(
|
||||
lastRange[usize::from(deltaY <= 0)] as f32,
|
||||
lastY as f32,
|
||||
));
|
||||
}
|
||||
return Ok(point(lastRange[0] as f32, lastY as f32));
|
||||
return Ok(point_f(lastRange[0] as f32, lastY as f32));
|
||||
} else {
|
||||
return Ok(point(lastRange[1] as f32, lastY as f32));
|
||||
return Ok(point_f(lastRange[1] as f32, lastY as f32));
|
||||
}
|
||||
} else {
|
||||
let lastX = x - deltaX;
|
||||
if lastRange[0] < centerY {
|
||||
if lastRange[1] > centerY {
|
||||
return Ok(point(
|
||||
return Ok(point_f(
|
||||
lastX as f32,
|
||||
lastRange[usize::from(deltaX >= 0)] as f32,
|
||||
));
|
||||
}
|
||||
return Ok(point(lastX as f32, lastRange[0] as f32));
|
||||
return Ok(point_f(lastX as f32, lastRange[0] as f32));
|
||||
} else {
|
||||
return Ok(point(lastX as f32, lastRange[1] as f32));
|
||||
return Ok(point_f(lastX as f32, lastRange[1] as f32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, Result},
|
||||
point, Exceptions, Point,
|
||||
point_f, Exceptions, Point,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -288,8 +288,8 @@ impl<'a> WhiteRectangleDetector<'_> {
|
||||
}
|
||||
|
||||
fn get_black_point_on_segment(&self, a_x: f32, a_y: f32, b_x: f32, b_y: f32) -> Option<Point> {
|
||||
let a = point(a_x, a_y);
|
||||
let b = point(b_x, b_y);
|
||||
let a = point_f(a_x, a_y);
|
||||
let b = point_f(b_x, b_y);
|
||||
|
||||
let dist = a.distance(b).round() as i32;
|
||||
let x_step: f32 = (b_x - a_x) / dist as f32;
|
||||
@@ -299,7 +299,7 @@ impl<'a> WhiteRectangleDetector<'_> {
|
||||
let x = (a_x + i as f32 * x_step).round() as i32;
|
||||
let y = (a_y + i as f32 * y_step).round() as i32;
|
||||
if self.image.get(x as u32, y as u32) {
|
||||
return Some(point(x as f32, y as f32));
|
||||
return Some(point_f(x as f32, y as f32));
|
||||
}
|
||||
}
|
||||
None
|
||||
@@ -337,17 +337,17 @@ impl<'a> WhiteRectangleDetector<'_> {
|
||||
|
||||
if yi < self.width as f32 / 2.0 {
|
||||
[
|
||||
point(ti - CORR as f32, tj + CORR as f32),
|
||||
point(zi + CORR as f32, zj + CORR as f32),
|
||||
point(xi - CORR as f32, xj - CORR as f32),
|
||||
point(yi + CORR as f32, yj - CORR as f32),
|
||||
point_f(ti - CORR as f32, tj + CORR as f32),
|
||||
point_f(zi + CORR as f32, zj + CORR as f32),
|
||||
point_f(xi - CORR as f32, xj - CORR as f32),
|
||||
point_f(yi + CORR as f32, yj - CORR as f32),
|
||||
]
|
||||
} else {
|
||||
[
|
||||
point(ti + CORR as f32, tj + CORR as f32),
|
||||
point(zi + CORR as f32, zj - CORR as f32),
|
||||
point(xi - CORR as f32, xj + CORR as f32),
|
||||
point(yi - CORR as f32, yj - CORR as f32),
|
||||
point_f(ti + CORR as f32, tj + CORR as f32),
|
||||
point_f(zi + CORR as f32, zj - CORR as f32),
|
||||
point_f(xi - CORR as f32, xj + CORR as f32),
|
||||
point_f(yi - CORR as f32, yj - CORR as f32),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user