vasturiano/d3-force-cluster-3d

Unstable z values

Closed this issue · 1 comments

When using the library I often have the z dimension reaching unexpected high values (and not recovering from it). I had a peek at the source and changing line 19 in cluster.js seems to fix it.

Original:

l = Math.sqrt(x * x + y * y);

Updated:

l = Math.sqrt(x * x + y * y + z * z);

Good catch @christiandewit. The z dimension is not being included in the distance calculation.
Would you like to open a PR with the fix?