1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 22:05:27 +02:00

use pow 2 to compare

This commit is contained in:
Justin Lin
2021-05-30 13:23:30 +08:00
parent e1df07da37
commit 4a80dc87d3

View File

@@ -17,7 +17,7 @@ function _packing_circles_overlapping(circles, c, i = 0) =
x = c[0] - circles[i][0], x = c[0] - circles[i][0],
y = c[1] - circles[i][1], y = c[1] - circles[i][1],
a = c[2] + circles[i][2], a = c[2] + circles[i][2],
collision = a >= sqrt(x * x + y * y) collision = a ^ 2 >= x ^2 + y ^ 2
) )
collision || _packing_circles_overlapping(circles, c, i + 1); collision || _packing_circles_overlapping(circles, c, i + 1);