Added comment, clean up stub API

This commit is contained in:
Pitchaya Boonsarngsuk
2018-01-31 08:37:23 +00:00
parent 409777bc14
commit 1966421975

View File

@@ -4,6 +4,7 @@ import jiggle from "./jiggle";
/**
* Modified link force algorithm
* - simplify calculations for parameters locked for spring model
* - replace the use of links {} with loop. greatly reduce memory usage
* - removed other unused functions
* Alpha should be constant 1 for accurate simulation
*/
@@ -39,6 +40,7 @@ export default function(links) {
function initialize() {
if (!nodes) return;
// 0.5 to divide the force to two part for source and target node
dataSizeFactor = 0.5/(nodes.length-1);
initializeDistance();
}
@@ -57,14 +59,6 @@ export default function(links) {
initialize();
};
force.links = function(_) {
return arguments.length ? (links = _, initialize(), force) : links;
};
force.id = function(_) {
return arguments.length ? (id = _, force) : id;
};
force.iterations = function(_) {
return arguments.length ? (iterations = +_, force) : iterations;
};