remove unnecessary number suffixes

This commit is contained in:
Vukašin Stepanović
2023-02-17 16:12:23 +00:00
parent 01e4f4a126
commit c77f0af6f6
21 changed files with 46 additions and 58 deletions

View File

@@ -29,9 +29,7 @@ static EPSILON: f32 = 1.0E-4f32;
#[test]
fn test_square_to_quadrilateral() {
let pt = PerspectiveTransform::squareToQuadrilateral(
2.0f32, 3.0f32, 10.0, 4.0, 16.0, 15.0, 4.0, 9.0,
);
let pt = PerspectiveTransform::squareToQuadrilateral(2.0, 3.0, 10.0, 4.0, 16.0, 15.0, 4.0, 9.0);
assert_point_equals(2.0, 3.0, 0.0, 0.0, &pt);
assert_point_equals(10.0, 4.0, 1.0, 0.0, &pt);
assert_point_equals(4.0, 9.0, 0.0, 1.0, &pt);

View File

@@ -23,7 +23,7 @@ use std::{cmp, fmt};
use crate::common::Result;
use crate::Exceptions;
static LOAD_FACTOR: f32 = 0.75f32;
static LOAD_FACTOR: f32 = 0.75;
/**
* <p>A simple, fast array of bits, represented compactly by an array of ints internally.</p>

View File

@@ -335,7 +335,7 @@ impl<'a> WhiteRectangleDetector<'_> {
let ti = t.x;
let tj = t.y;
if yi < self.width as f32 / 2.0f32 {
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),

View File

@@ -241,7 +241,7 @@ impl GlobalHistogramBinarizer {
// Find a valley between them that is low and closer to the white peak.
let mut bestValley = secondPeak - 1;
let mut bestValleyScore = -1i32;
let mut bestValleyScore = -1;
let mut x = secondPeak;
while x > firstPeak {
// for (int x = secondPeak - 1; x > firstPeak; x--) {

View File

@@ -179,7 +179,7 @@ impl HybridBinarizer {
}
let left = Self::cap(x, sub_width - 3);
let mut sum = 0;
for z in -2i32..=2 {
for z in -2..=2 {
// for (int z = -2; z <= 2; z++) {
let blackRow = &black_points[(top as i32 + z) as usize];
sum += blackRow[(left - 2) as usize]
@@ -255,7 +255,7 @@ impl HybridBinarizer {
if xoffset > maxXOffset as u32 {
xoffset = maxXOffset as u32;
}
let mut sum = 0u32;
let mut sum: u32 = 0;
let mut min = 0xff;
let mut max = 0;

View File

@@ -133,19 +133,9 @@ impl PerspectiveTransform {
) -> Self {
let dx3 = x0 - x1 + x2 - x3;
let dy3 = y0 - y1 + y2 - y3;
if dx3 == 0.0f32 && dy3 == 0.0f32 {
if dx3 == 0.0 && dy3 == 0.0 {
// Affine
PerspectiveTransform::new(
x1 - x0,
x2 - x1,
x0,
y1 - y0,
y2 - y1,
y0,
0.0f32,
0.0f32,
1.0f32,
)
PerspectiveTransform::new(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0, 0.0, 1.0)
} else {
let dx1 = x1 - x2;
let dx2 = x3 - x2;
@@ -163,7 +153,7 @@ impl PerspectiveTransform {
y0,
a13,
a23,
1.0f32,
1.0,
)
}
}

View File

@@ -348,7 +348,7 @@ pub(crate) fn corrupt(
) {
let mut corrupted = vec![false; received.len()];
//BitSet corrupted = new BitSet(received.length);
let mut j = 0isize;
let mut j: isize = 0;
while j < howMany as isize {
// for (int j = 0; j < howMany; j++) {
let location: usize = random.gen_range(0..received.len());
@@ -477,7 +477,7 @@ fn test_decoder(field: GenericGFRef, dataWords: &Vec<i32>, ecWords: &Vec<i32>) {
};
for _j in 0..iterations {
//for (int j = 0; j < iterations; j++) {
let mut i = 0isize;
let mut i: isize = 0;
while i < ecWords.len() as isize {
//for (int i = 0; i < ecWords.length; i++) {
if i > 10 && i < ecWords.len() as isize / 2 - 10 {