From 25e8455084a4d40634163ec13274138c16d8f70d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 14 Sep 2024 09:19:52 -0400 Subject: [PATCH] findClosest optimization --- arc-core/src/arc/math/geom/Geometry.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arc-core/src/arc/math/geom/Geometry.java b/arc-core/src/arc/math/geom/Geometry.java index 7d0228d7..0372aa12 100644 --- a/arc-core/src/arc/math/geom/Geometry.java +++ b/arc-core/src/arc/math/geom/Geometry.java @@ -91,7 +91,7 @@ public static T findClosest(float x, float y, T[] list){ T closest = null; float cdist = 0f; for(T t : list){ - float dst = t.dst(x, y); + float dst = t.dst2(x, y); if(closest == null || dst < cdist){ closest = t; cdist = dst; @@ -104,7 +104,7 @@ public static T findClosest(float x, float y, Iterable l T closest = null; float cdist = 0f; for(T t : list){ - float dst = t.dst(x, y); + float dst = t.dst2(x, y); if(closest == null || dst < cdist){ closest = t; cdist = dst; @@ -117,7 +117,7 @@ public static T findFurthest(float x, float y, Iterable T furthest = null; float fdist = 0f; for(T t : list){ - float dst = t.dst(x, y); + float dst = t.dst2(x, y); if(furthest == null || dst > fdist){ furthest = t; fdist = dst;