Skip to content

Commit

Permalink
Fixed inaccuracy is MathUtils#approxEquals utility
Browse files Browse the repository at this point in the history
  • Loading branch information
funkemunky committed Aug 27, 2019
1 parent 6fefb74 commit 96f92d4
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public static boolean playerMoved(Location from, Location to) {
return playerMoved(from.toVector(), to.toVector());
}

public static boolean approxEquals(double accuracy, double... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / equals.length, equals[0]) < accuracy;
public static boolean approxEquals(double accuracy, double equalTo, double... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / equals.length, equalTo) < accuracy;
}

public static boolean approxEquals(double accuracy, int... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / (double)equals.length, equals[0]) < accuracy;
public static boolean approxEquals(double accuracy, int equalTo, int... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / equals.length, equalTo) < accuracy;
}

public static boolean approxEquals(double accuracy, long... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / (double)equals.length, equals[0]) < accuracy;
public static boolean approxEquals(double accuracy, long equalTo, long... equals) {
return MathUtils.getDelta(Arrays.stream(equals).sum() / equals.length, equalTo) < accuracy;
}

public static double getDistanceToBox(Vector vec, BoundingBox box) {
Expand Down

0 comments on commit 96f92d4

Please sign in to comment.