partial success on parse, missing symbology id

This commit is contained in:
Henry Schimke
2023-04-22 16:17:05 -05:00
parent 789719d3eb
commit bec7c99dbb
11 changed files with 34 additions and 18 deletions

View File

@@ -21,7 +21,7 @@
use std::fmt;
use crate::common::Result;
use crate::{point, Exceptions, Point};
use crate::{point, Exceptions, Point, point_i};
use super::BitArray;
@@ -223,7 +223,14 @@ impl BitMatrix {
}
pub fn get_index<T: Into<usize>>(&self, index: T) -> bool {
todo!()
self.get_point(self.calculate_point_from_index(index.into()))
}
#[inline(always)]
fn calculate_point_from_index(&self, index: usize) -> Point {
let row = index / (self.getWidth() as usize);
let column = index % (self.getWidth() as usize);
point_i(column as u32, row as u32)
}
#[inline(always)]

View File

@@ -1,3 +1,5 @@
use crate::common::BitMatrix;
use super::BitMatrixCursorTrait;
pub struct FastEdgeToEdgeCounter {
@@ -9,11 +11,11 @@ pub struct FastEdgeToEdgeCounter {
stepsToBorder: i32, // = 0;
//arr: BitArray,
_arr: isize,
under_arry: Vec<bool>,
under_arry: Vec<bool>//&'a BitMatrix//,
}
impl FastEdgeToEdgeCounter {
pub fn new<T: BitMatrixCursorTrait>(cur: &T) -> Self {
pub fn new<T: BitMatrixCursorTrait>(cur: &T) -> FastEdgeToEdgeCounter {
let stride = cur.d().y as isize * cur.img().width() as isize + cur.d().x as isize;
let p = ((cur.p().y as isize * cur.img().width() as isize).abs() as i32 + cur.p().x as i32) as u32; // P IS SET WRONG IN REVERSE
@@ -37,7 +39,7 @@ impl FastEdgeToEdgeCounter {
};
let stepsToBorder = std::cmp::min(maxStepsX, maxStepsY) as i32;
Self {
FastEdgeToEdgeCounter {
p,
stride,
stepsToBorder,
@@ -63,6 +65,7 @@ impl FastEdgeToEdgeCounter {
if !(self.under_arry[idx_pt]
== self.under_arry[self.p as usize])
// if !(self.under_arry.get_index(idx_pt) == self.under_arry.get_index(self.p as usize))
{
break true;
}

View File

@@ -89,7 +89,7 @@ impl GridSampler for DefaultGridSampler {
Point::default()
};
let tl = projectCorner(point(0.0, 0.0));
let tl = projectCorner(Point::default());
let tr = projectCorner(Point::from((dimensionX, 0)));
let bl = projectCorner(Point::from((dimensionX, dimensionY)));
let br = projectCorner(Point::from((0, dimensionX)));