MCPcopy Create free account
hub / github.com/microsoft/SandDance / initializeNodes

Function initializeNodes

docs/app/js/sanddance-app.js:136450–136462  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

sanddance-app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected