Permalink
Browse files

Made node repulsion a bit better

  • Loading branch information...
1 parent aaa3f7b commit 2f8d0c17a6ae11fb9a3a1bd212dd0a13d84e3542 @johngunderman committed May 9, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 graph.js
View
@@ -21,7 +21,7 @@ var Q_CONST = 1;
var K_SPRING = 3;
// damping factor for our force-based layout algorithm
var DAMPING = .5;
-var TIMESTEP = .2;
+var TIMESTEP = .1;
function drawTree(tree) {
stage.clear();
@@ -327,7 +327,8 @@ function nodeRepulsion(node1, node2) {
var force = 0;
- force = KE * Math.pow(Q_CONST, 2) / Math.pow(r,2);
+ force = KE * Math.pow(node1.nodeDegree - 2, 1.5)
+ * Math.pow(Q_CONST, 2) / Math.pow(r,2);
if (r < 0) {
force = -force;

0 comments on commit 2f8d0c1

Please sign in to comment.