From dfe98c19cfb80c28dcc4c38017434e4c13e92e89 Mon Sep 17 00:00:00 2001 From: Wouter van Wageningen Date: Sun, 24 Dec 2023 15:39:33 -0800 Subject: [PATCH] Update utils.mjs Fix #5697 --- packages/core/src/utils.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/utils.mjs b/packages/core/src/utils.mjs index 4cce822da71..77eee695f43 100644 --- a/packages/core/src/utils.mjs +++ b/packages/core/src/utils.mjs @@ -167,7 +167,7 @@ export function circlesIntersect(c1, r1, c2, r2, sort = 'x') { let dist = c1.dist(c2) // Check for edge cases if (dist > parseFloat(r1) + parseFloat(r2)) return false // Circles do not intersect - if (dist < parseFloat(r2) - parseFloat(r1)) return false // One circle is contained in the other + if (dist < Math.abs(parseFloat(r2) - parseFloat(r1))) return false // One circle is contained in the other if (dist === 0 && r1 === r2) return false // Two circles are identical let chorddistance = (Math.pow(r1, 2) - Math.pow(r2, 2) + Math.pow(dist, 2)) / (2 * dist) let halfchordlength = Math.sqrt(Math.pow(r1, 2) - Math.pow(chorddistance, 2))