| 136448 | return simulation; |
| 136449 | } |
| 136450 | function initializeNodes() { |
| 136451 | for(var i = 0, n = nodes.length, node; i < n; ++i){ |
| 136452 | node = nodes[i], node.index = i; |
| 136453 | if (node.fx != null) node.x = node.fx; |
| 136454 | if (node.fy != null) node.y = node.fy; |
| 136455 | if (isNaN(node.x) || isNaN(node.y)) { |
| 136456 | var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; |
| 136457 | node.x = radius * Math.cos(angle); |
| 136458 | node.y = radius * Math.sin(angle); |
| 136459 | } |
| 136460 | if (isNaN(node.vx) || isNaN(node.vy)) node.vx = node.vy = 0; |
| 136461 | } |
| 136462 | } |
| 136463 | function initializeForce(force) { |
| 136464 | if (force.initialize) force.initialize(nodes, random); |
| 136465 | return force; |