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:
@@ -1,6 +1,6 @@
|
||||
use crate::common::BitMatrix;
|
||||
use crate::common::Result;
|
||||
use crate::point;
|
||||
use crate::point_f;
|
||||
use crate::Point;
|
||||
|
||||
impl BitMatrix {
|
||||
@@ -19,7 +19,7 @@ impl BitMatrix {
|
||||
let yOffset = top + y as f32 * subSampling;
|
||||
for x in 0..result.width() {
|
||||
// for (int x = 0; x < result.width(); x++) {
|
||||
if self.get_point(point(left + x as f32 * subSampling, yOffset)) {
|
||||
if self.get_point(point_f(left + x as f32 * subSampling, yOffset)) {
|
||||
result.set(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
},
|
||||
BitMatrix, Quadrilateral,
|
||||
},
|
||||
point, Point,
|
||||
point_f, Point,
|
||||
};
|
||||
|
||||
use super::{
|
||||
@@ -172,10 +172,10 @@ pub fn CenterOfDoubleCross(
|
||||
let mut sum = Point::default();
|
||||
|
||||
for d in [
|
||||
point(0.0, 1.0),
|
||||
point(1.0, 0.0),
|
||||
point(1.0, 1.0),
|
||||
point(1.0, -1.0),
|
||||
point_f(0.0, 1.0),
|
||||
point_f(1.0, 0.0),
|
||||
point_f(1.0, 1.0),
|
||||
point_f(1.0, -1.0),
|
||||
] {
|
||||
// for (auto d : {PointI{0, 1}, {1, 0}, {1, 1}, {1, -1}}) {
|
||||
let avr1 = AverageEdgePixels(&mut EdgeTracer::new(image, center, d), range, numOfEdges)?;
|
||||
@@ -199,7 +199,7 @@ pub fn CenterOfRing(
|
||||
let inner = nth < 0;
|
||||
let nth = nth.abs();
|
||||
// log(center, 3);
|
||||
let mut cur = EdgeTracer::new(image, center, point(0.0, 1.0));
|
||||
let mut cur = EdgeTracer::new(image, center, point_f(0.0, 1.0));
|
||||
if cur.stepToEdge(Some(nth), Some(radius), Some(inner)) == 0 {
|
||||
return None;
|
||||
}
|
||||
@@ -224,7 +224,7 @@ pub fn CenterOfRing(
|
||||
<< (4.0
|
||||
+ Point::dot(
|
||||
Point::floor(Point::bresenhamDirection(cur.p() - center)),
|
||||
point(1.0, 3.0),
|
||||
point_f(1.0, 3.0),
|
||||
)) as u32;
|
||||
|
||||
if !cur.stepAlongEdge(edgeDir, None) {
|
||||
@@ -288,7 +288,7 @@ pub fn CollectRingPoints(
|
||||
) -> Vec<Point> {
|
||||
let centerI = center.floor();
|
||||
let radius = range;
|
||||
let mut cur = EdgeTracer::new(image, centerI, point(0.0, 1.0));
|
||||
let mut cur = EdgeTracer::new(image, centerI, point_f(0.0, 1.0));
|
||||
if cur.stepToEdge(Some(edgeIndex), Some(radius), Some(backup)) == 0 {
|
||||
return Vec::default();
|
||||
}
|
||||
@@ -312,7 +312,7 @@ pub fn CollectRingPoints(
|
||||
<< (4.0
|
||||
+ Point::dot(
|
||||
Point::round(Point::bresenhamDirection(cur.p - centerI)),
|
||||
point(1.0, 3.0),
|
||||
point_f(1.0, 3.0),
|
||||
)) as u32;
|
||||
|
||||
if !cur.stepAlongEdge(edgeDir, None) {
|
||||
@@ -557,7 +557,7 @@ pub fn LocateConcentricPattern<const E2E: bool, const LEN: usize, const SUM: usi
|
||||
// TODO: setting maxError to 1 can subtantially help with detecting symbols with low print quality resulting in damaged
|
||||
// finder patterns, but it sutantially increases the runtime (approx. 20% slower for the falsepositive images).
|
||||
let mut maxError = 0;
|
||||
for d in [point(0.0, 1.0), point(1.0, 0.0)] {
|
||||
for d in [point_f(0.0, 1.0), point_f(1.0, 0.0)] {
|
||||
// for (auto d : {PointI{0, 1}, {1, 0}}) {
|
||||
cur.setDirection(d); // THIS COULD POSSIBLY BE WRONG, WE MIGHT MEAN TO CLONE cur EACH RUN?
|
||||
|
||||
@@ -573,7 +573,7 @@ pub fn LocateConcentricPattern<const E2E: bool, const LEN: usize, const SUM: usi
|
||||
}
|
||||
|
||||
//#if 1
|
||||
for d in [point(1.0, 1.0), point(1.0, -1.0)] {
|
||||
for d in [point_f(1.0, 1.0), point_f(1.0, -1.0)] {
|
||||
// for (auto d : {PointI{1, 1}, {1, -1}}) {
|
||||
cur.setDirection(d); // THIS COULD POSSIBLY BE WRONG, WE MIGHT MEAN TO CLONE cur EACH RUN?
|
||||
let spread = CheckSymmetricPattern::<E2E, LEN, SUM, _>(&mut cur, pattern, range * 2, false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::common::Result;
|
||||
use crate::{point, Point};
|
||||
use crate::{point_f, Point};
|
||||
|
||||
pub trait RegressionLineTrait {
|
||||
// points: Vec<Point>,
|
||||
@@ -23,7 +23,7 @@ pub trait RegressionLineTrait {
|
||||
let x = (l1.c() * l2.b() - l1.b() * l2.c()) / d;
|
||||
let y = (l1.a() * l2.c() - l1.c() * l2.a()) / d;
|
||||
|
||||
Some(point(x, y))
|
||||
Some(point_f(x, y))
|
||||
}
|
||||
|
||||
// fn evaluate_begin_end(&self, begin: Point, end: Point) -> bool;// {
|
||||
|
||||
Reference in New Issue
Block a user