mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
80 lines
2.7 KiB
Java
80 lines
2.7 KiB
Java
package com.google.zxing;
|
|
|
|
import com.google.zxing.common.detector.MathUtils;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class ResultPoint {
|
|
private final float x;
|
|
private final float y;
|
|
|
|
public final float getX() {
|
|
return this.x;
|
|
}
|
|
|
|
public final float getY() {
|
|
return this.y;
|
|
}
|
|
|
|
public ResultPoint(float f, float f2) {
|
|
this.x = f;
|
|
this.y = f2;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj instanceof ResultPoint) {
|
|
ResultPoint resultPoint = (ResultPoint) obj;
|
|
if (this.x == resultPoint.x && this.y == resultPoint.y) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return (Float.floatToIntBits(this.x) * 31) + Float.floatToIntBits(this.y);
|
|
}
|
|
|
|
public final String toString() {
|
|
return "(" + this.x + ',' + this.y + ')';
|
|
}
|
|
|
|
public static void orderBestPatterns(ResultPoint[] resultPointArr) {
|
|
ResultPoint resultPoint;
|
|
ResultPoint resultPoint2;
|
|
ResultPoint resultPoint3;
|
|
float distance = distance(resultPointArr[0], resultPointArr[1]);
|
|
float distance2 = distance(resultPointArr[1], resultPointArr[2]);
|
|
float distance3 = distance(resultPointArr[0], resultPointArr[2]);
|
|
if (distance2 >= distance && distance2 >= distance3) {
|
|
resultPoint = resultPointArr[0];
|
|
resultPoint2 = resultPointArr[1];
|
|
resultPoint3 = resultPointArr[2];
|
|
} else if (distance3 >= distance2 && distance3 >= distance) {
|
|
resultPoint = resultPointArr[1];
|
|
resultPoint2 = resultPointArr[0];
|
|
resultPoint3 = resultPointArr[2];
|
|
} else {
|
|
resultPoint = resultPointArr[2];
|
|
resultPoint2 = resultPointArr[0];
|
|
resultPoint3 = resultPointArr[1];
|
|
}
|
|
if (crossProductZ(resultPoint2, resultPoint, resultPoint3) < 0.0f) {
|
|
ResultPoint resultPoint4 = resultPoint3;
|
|
resultPoint3 = resultPoint2;
|
|
resultPoint2 = resultPoint4;
|
|
}
|
|
resultPointArr[0] = resultPoint2;
|
|
resultPointArr[1] = resultPoint;
|
|
resultPointArr[2] = resultPoint3;
|
|
}
|
|
|
|
public static float distance(ResultPoint resultPoint, ResultPoint resultPoint2) {
|
|
return MathUtils.distance(resultPoint.x, resultPoint.y, resultPoint2.x, resultPoint2.y);
|
|
}
|
|
|
|
private static float crossProductZ(ResultPoint resultPoint, ResultPoint resultPoint2, ResultPoint resultPoint3) {
|
|
float f = resultPoint2.x;
|
|
float f2 = resultPoint2.y;
|
|
return ((resultPoint3.x - f) * (resultPoint.y - f2)) - ((resultPoint3.y - f2) * (resultPoint.x - f));
|
|
}
|
|
}
|