flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
21
VISUALIZACION/node_modules/d3-quadtree/src/visitAfter.js
generated
vendored
Executable file
21
VISUALIZACION/node_modules/d3-quadtree/src/visitAfter.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
import Quad from "./quad.js";
|
||||
|
||||
export default function(callback) {
|
||||
var quads = [], next = [], q;
|
||||
if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1));
|
||||
while (q = quads.pop()) {
|
||||
var node = q.node;
|
||||
if (node.length) {
|
||||
var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
|
||||
if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym));
|
||||
if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym));
|
||||
if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1));
|
||||
if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1));
|
||||
}
|
||||
next.push(q);
|
||||
}
|
||||
while (q = next.pop()) {
|
||||
callback(q.node, q.x0, q.y0, q.x1, q.y1);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue