MCPcopy Create free account
hub / github.com/breck7/scroll / apply

Function apply

external/.d3.js:8896–8916  ·  view source on GitHub ↗
(quad, x0, y0, x1, y1)

Source from the content-addressed store, hash-verified

8894 }
8895
8896 function apply(quad, x0, y0, x1, y1) {
8897 var data = quad.data, rj = quad.r, r = ri + rj;
8898 if (data) {
8899 if (data.index > node.index) {
8900 var x = xi - data.x - data.vx,
8901 y = yi - data.y - data.vy,
8902 l = x * x + y * y;
8903 if (l < r * r) {
8904 if (x === 0) x = jiggle(random), l += x * x;
8905 if (y === 0) y = jiggle(random), l += y * y;
8906 l = (r - (l = Math.sqrt(l))) / l * strength;
8907 node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
8908 node.vy += (y *= l) * r;
8909 data.vx -= x * (r = 1 - r);
8910 data.vy -= y * r;
8911 }
8912 }
8913 return;
8914 }
8915 return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
8916 }
8917 }
8918
8919 function prepare(quad) {

Callers

nothing calls this directly

Calls 1

jiggleFunction · 0.85

Tested by

no test coverage detected