mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 18:39:27 -05:00
switch to Math.sqrt from Math.hypot
This commit is contained in:
@@ -645,7 +645,7 @@ function distance(a, b) {
|
|||||||
const dx = Math.max(bLeft - aRight, aLeft - bRight, 0);
|
const dx = Math.max(bLeft - aRight, aLeft - bRight, 0);
|
||||||
const dy = Math.max(bTop - aBottom, aTop - bBottom, 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
|
function random_away(x,y,R) // https://stackoverflow.com/a/5838055/914546
|
||||||
|
|||||||
Reference in New Issue
Block a user