Question

For the collision detection example and other quadtree applications, how does d3 update the quadtree used inside the "tick" timer callback? E.g. is the quadtree always recomputed "from scratch" inside

force.on("tick", function(e) {
  var q = d3.geom.quadtree(nodes),
      i = 0,
      n = nodes.length;
...

each time the positions of the data-bound objects stored in the "data" array changes, or is it updating the previous quadtree in some more efficient manner?

This question is related to a previous question that has already been answered. Also the link

https://github.com/mbostock/d3/blob/master/d3.geom.js#L696

on the previous question's page seems broken now and not sure how to fix this myself.

Sorry about the confusion, any help is appreciated!

Danny

Was it helpful?

Solution

In the example you've linked to, the quadtree is recomputed from scratch on each tick. It doesn't save the tree for the next iteration once computed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top