From 96f92d48136bccbc611949fb8ce579705f470703 Mon Sep 17 00:00:00 2001 From: Dawson Hessler Date: Tue, 27 Aug 2019 07:43:31 -0400 Subject: [PATCH] Fixed inaccuracy is MathUtils#approxEquals utility --- .../main/java/cc/funkemunky/api/utils/MathUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AtlasParent/Atlas/src/main/java/cc/funkemunky/api/utils/MathUtils.java b/AtlasParent/Atlas/src/main/java/cc/funkemunky/api/utils/MathUtils.java index a20daf4a..5e0ee031 100644 --- a/AtlasParent/Atlas/src/main/java/cc/funkemunky/api/utils/MathUtils.java +++ b/AtlasParent/Atlas/src/main/java/cc/funkemunky/api/utils/MathUtils.java @@ -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) {