MCPcopy Index your code
hub / github.com/jipegit/OSXAuditor / insert

Function insert

d3-3.2.8/d3.js:4855–4874  ·  view source on GitHub ↗
(n, d, x, y, x1, y1, x2, y2)

Source from the content-addressed store, hash-verified

4853 var dx = x2_ - x1_, dy = y2_ - y1_;
4854 if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;
4855 function insert(n, d, x, y, x1, y1, x2, y2) {
4856 if (isNaN(x) || isNaN(y)) return;
4857 if (n.leaf) {
4858 var nx = n.x, ny = n.y;
4859 if (nx != null) {
4860 if (Math.abs(nx - x) + Math.abs(ny - y) < .01) {
4861 insertChild(n, d, x, y, x1, y1, x2, y2);
4862 } else {
4863 var nPoint = n.point;
4864 n.x = n.y = n.point = null;
4865 insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
4866 insertChild(n, d, x, y, x1, y1, x2, y2);
4867 }
4868 } else {
4869 n.x = x, n.y = y, n.point = d;
4870 }
4871 } else {
4872 insertChild(n, d, x, y, x1, y1, x2, y2);
4873 }
4874 }
4875 function insertChild(n, d, x, y, x1, y1, x2, y2) {
4876 var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right;
4877 n.leaf = false;

Callers 2

insertChildFunction · 0.85
quadtreeFunction · 0.85

Calls 1

insertChildFunction · 0.85

Tested by

no test coverage detected