Skip to content

Commit f90e037

Browse files
committed
Avoid NaNs when node coincides with cluster centerpoint, per pull #1 from @nvie
1 parent 5f5a815 commit f90e037

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/forceCluster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function cluster (centers) {
2727
l = Math.sqrt(x * x + y * y),
2828
r = d.radius + (c.radius || 0);
2929

30-
if (l != r) {
30+
if (l && l != r) {
3131
l = (l - r) / l * alpha;
3232
d.x -= x *= l;
3333
d.y -= y *= l;

0 commit comments

Comments
 (0)