switch to Math.sqrt from Math.hypot

This commit is contained in:
Kent Rasmussen
2025-05-25 14:48:24 +09:00
parent ec764b4430
commit a5de1df6c7
+1 -1
View File
@@ -645,7 +645,7 @@ function distance(a, b) {
const dx = Math.max(bLeft - aRight, aLeft - bRight, 0);
const dy = Math.max(bTop - aBottom, aTop - bBottom, 0);
return Math.hypot(dx, dy);
return Math.sqrt(dx * dx + dy * dy);
}
function random_away(x,y,R) // https://stackoverflow.com/a/5838055/914546