Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abs weighted average in manyBody barnes-hut coords #98

Merged
merged 1 commit into from
Sep 23, 2017

Conversation

vasturiano
Copy link
Contributor

The quadrant coordinates for the Barnes-Hut approx in forceManyBody are calculated using a weighted average according to the child strengths. However, the current calc is not accounting for negative strengths which may throw off the quad.x/quad.y coords. Furthermore the issue is aggravated when combining positive and negative strengths, which will result in a reduced aggregated strength (due to cancellation), leading to very high values of x and y.

I came across the issue when noticing combined nodes with positive and negative strengths having a much lower force intensity, due to the quadrant centers being much more distant.

This patch abs the weights in the average to fix the issue.

@mbostock mbostock merged commit 258b35d into d3:master Sep 23, 2017
@mbostock
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants