Commit Graph

19 Commits

Author SHA1 Message Date
Steve Haroz
19d0e8e897 reinitialize radii after collide.radius() (#63) 2016-10-07 09:18:50 -05:00
Mike Bostock
85b0b09d34 Minor optimization.
Don’t test the bounding box on leaf nodes; test the circles.
2016-05-04 08:40:17 -07:00
Mike Bostock
f15a5adad7 Process collisions serially.
It’s tempting to do them independently (in parallel), but this makes convergence
much slower. We’re now moving nodes while they’re in the quadtree, which means
we could miss a few collisions; but since the tree is rebuilt on each iteration
that should probably be fine.

This reverts part of 95354e8470, though it retains
the area-biased resolution and the performance improvements.
2016-05-04 07:32:18 -07:00
Mike Bostock
ca3aecc94e Tiny optimization. 2016-05-03 22:29:50 -07:00
Mike Bostock
563481bb5a Tiny optimization. 2016-05-03 16:15:55 -07:00
Mike Bostock
95354e8470 Improve collision detection.
Fix #25. We now resolve collisions for all nodes independently, rather than
moving one node at a time. And since we’re not mutating the quadtree while
resolving, the quadtree can now store the maximum radius for each quadrant,
accelerating search! We can also optimize resolution a little bit since now
resolutions are always symmetric.

Collision resolutions are now biased so that the acceleration is inversely
proportional to the circle’s area, such that larger circles (which are more
likely to overlap many small circles) are more stable.

Also: only jiggle if two circles are overlapping.
2016-05-03 16:07:44 -07:00
Mike Bostock
15d5bb7d5b Separate dimensions for coincidence test.
Fixes #23. This doesn’t catch all degenerate configurations, such as when x = y,
but it at least handles a common case for geometric constraints. As an added
bonus, this commit avoids extraneous jiggling in the many-body force when
visiting testing the target node’s quadtree cell.
2016-04-29 10:38:16 -07:00
Mike Bostock
cf287b8dba Fix exact coincidence with d3.forceCollide. 2016-04-29 09:33:17 -07:00
Mike Bostock
5d321b2190 Allow iterative constraint application.
Adds {forceCollide,forceLink}.iterations, which defaults to one.
2016-04-27 11:20:21 -07:00
Mike Bostock
93e0397120 Improve stability of collision & links.
We need to look into the future!
2016-04-27 11:03:13 -07:00
Mike Bostock
3810e0fa11 Pass nodes to force.initialize. 2016-04-25 21:47:24 -07:00
Mike Bostock
48836d0dfb Pass radius to d3.forceCollide constructor. 2016-04-25 14:00:54 -07:00
Mike Bostock
2dcf98c650 Add a tiny bit of blending to collision.
This greatly improves stability.
2016-04-25 09:38:39 -07:00
Mike Bostock
a6dcf0c876 Improve stability of collision detection. 2016-04-23 14:24:37 -07:00
Mike Bostock
6ad4bc2663 More stable collision detection. 2016-04-23 09:48:31 -07:00
Mike Bostock
74bfd620a3 Better collision detection.
By looking into the future, we can better avoid collisions.

Also remove duplicate initialization of node positions.
2016-04-22 13:04:57 -07:00
Mike Bostock
8c2113f53c Fix manyBody force. 2016-04-22 09:55:12 -07:00
Mike Bostock
d6f45ffc53 Update to d3-quadtree 0.7. 2016-04-22 09:45:03 -07:00
Mike Bostock
dfe79d5c7d Add collision force. 2016-04-21 17:49:52 -07:00