(dimension, size)
| 5638 | charges = []; |
| 5639 | if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge; |
| 5640 | function position(dimension, size) { |
| 5641 | var neighbors = neighbor(i), j = -1, m = neighbors.length, x; |
| 5642 | while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x; |
| 5643 | return Math.random() * size; |
| 5644 | } |
| 5645 | function neighbor() { |
| 5646 | if (!neighbors) { |
| 5647 | neighbors = []; |