mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-28 05:12:34 +00:00
start convert file by file
This commit is contained in:
@@ -14,15 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.common.detector;
|
//package com.google.zxing.common.detector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General math-related and numeric utility functions.
|
* General math-related and numeric utility functions.
|
||||||
*/
|
*/
|
||||||
public final class MathUtils {
|
|
||||||
|
|
||||||
private MathUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its
|
* Ends up being a bit faster than {@link Math#round(float)}. This merely rounds its
|
||||||
@@ -33,8 +29,8 @@ public final class MathUtils {
|
|||||||
* @param d real value to round
|
* @param d real value to round
|
||||||
* @return nearest {@code int}
|
* @return nearest {@code int}
|
||||||
*/
|
*/
|
||||||
public static int round(float d) {
|
pub fn round(d:f32) -> i32 {
|
||||||
return (int) (d + (d < 0.0f ? -0.5f : 0.5f));
|
return (d + (if d < 0.0f { -0.5f } else { 0.5f}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,10 +40,10 @@ public final class MathUtils {
|
|||||||
* @param bY point B y coordinate
|
* @param bY point B y coordinate
|
||||||
* @return Euclidean distance between points A and B
|
* @return Euclidean distance between points A and B
|
||||||
*/
|
*/
|
||||||
public static float distance(float aX, float aY, float bX, float bY) {
|
pub fn distance( aX:f32, aY:f32, bX: f32, bY:f32) -> f32 {
|
||||||
double xDiff = aX - bX;
|
let xDiff:f64 = aX - bX;
|
||||||
double yDiff = aY - bY;
|
let yDiff:f64 = aY - bY;
|
||||||
return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);
|
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,22 +53,20 @@ public final class MathUtils {
|
|||||||
* @param bY point B y coordinate
|
* @param bY point B y coordinate
|
||||||
* @return Euclidean distance between points A and B
|
* @return Euclidean distance between points A and B
|
||||||
*/
|
*/
|
||||||
public static float distance(int aX, int aY, int bX, int bY) {
|
pub fn distance( aX : i32, aY: i32, bX: i32, bY: i32) -> f32 {
|
||||||
double xDiff = aX - bX;
|
let xDiff : f64 = aX - bX;
|
||||||
double yDiff = aY - bY;
|
let yDiff :f64 = aY - bY;
|
||||||
return (float) Math.sqrt(xDiff * xDiff + yDiff * yDiff);
|
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array values to sum
|
* @param array values to sum
|
||||||
* @return sum of values in array
|
* @return sum of values in array
|
||||||
*/
|
*/
|
||||||
public static int sum(int[] array) {
|
pub fn sum( array : &[i32]) -> i32 {
|
||||||
int count = 0;
|
let count = 0;
|
||||||
for (int a : array) {
|
for a in array {
|
||||||
count += a;
|
count += a;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -14,11 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.zxing.common.detector;
|
//package com.google.zxing.common.detector;
|
||||||
|
use crate::{NotFoundException,ResultPoint};
|
||||||
|
use crate::common::BitMatrix;
|
||||||
|
|
||||||
import com.google.zxing.NotFoundException;
|
|
||||||
import com.google.zxing.ResultPoint;
|
|
||||||
import com.google.zxing.common.BitMatrix;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>A somewhat generic detector that looks for a barcode-like rectangular region within an image.
|
* <p>A somewhat generic detector that looks for a barcode-like rectangular region within an image.
|
||||||
Reference in New Issue
Block a user