From 46f2e36ab85360a7c86f6d0e07ed10b1fbcfcbab Mon Sep 17 00:00:00 2001
From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk>
Date: Wed, 7 Feb 2018 15:57:46 +0000
Subject: [PATCH 1/2] Fix packages: rimraf isn't standard linux command
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 8fe5214..df75408 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"main": "build/d3-spring-model.js",
"jsnext:main": "index",
"scripts": {
- "build": "rimraf build && mkdir build && rollup -g d3-force:d3,d3-dispatch:d3,d3-quadtree:d3,d3-collection:d3 -f umd -n d3 -o build/d3-spring-model.js -- index.js",
+ "build": "rm -rf build && mkdir build && rollup -g d3-force:d3,d3-dispatch:d3,d3-quadtree:d3,d3-collection:d3 -f umd -n d3 -o build/d3-spring-model.js -- index.js",
"minify": "node_modules/uglify-es/bin/uglifyjs build/d3-spring-model.js -c -m -o build/d3-spring-model.min.js",
"zip": "zip -j build/d3-spring-model.zip -- LICENSE README.md build/d3-spring-model.js build/d3-spring-model.min.js"
},
From 95c6a077c28205c8708db43ebbd2e4fb690649ae Mon Sep 17 00:00:00 2001
From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk>
Date: Tue, 6 Feb 2018 13:40:25 +0000
Subject: [PATCH 2/2] Update readme for the new API
---
README.md | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 8c3ad8b..83173cf 100644
--- a/README.md
+++ b/README.md
@@ -87,6 +87,18 @@ The resulting number is then stored internally, such that the distance of each l
If *iterations* is specified, sets the number of iterations per application to the specified number and returns this force. If *iterations* is not specified, returns the current iteration count which defaults to 1. Increasing the number of iterations greatly increases the rigidity of the constraint, but also increases the runtime cost to evaluate the force.
+# *springLink*.**latestAccel**()
+
+Returns the average velocity changes of the latest iteration.
+
+# *springLink*.**stableVelocity**([*threshold*])
+
+If *threshold* is specified, sets a threshold and returns this force. When the average velocity changes of the system goes below the threshold, the function [onStableVelo's handler](#springLink_onStableVelo) will be called. Set it to 0 or less or remove the [handler](#neighbourSampling_latestForce) to disable the threshold checking. If *threshold* is not specified, returns the current value, which defaults to 0.
+
+# *springLink*.**onStableVelo**([*handler*])
+
+If *handler* is specified, sets a handler function which will be called at the end of each iteration if the average velocity changes of the system goes below the [threshold](#neighbourSampling_stableVelocity), and returns this force. To remove the handler, change it to null. If *threshold* is not specified, returns the current value, which defaults to null.
+
### Neighbour and Sampling
The neighbour and sampling algorithm simplifies the model by only calculating the spring force of each node against several nearby and random nodes, at the cost of providing less accurate layout. In order for it to work properly, a distance function should be specified.
@@ -125,11 +137,11 @@ Returns the average velocity changes of the latest iteration.
# *neighbourSampling*.**stableVelocity**([*threshold*])
-If *threshold* is specified, sets a threshold and returns this force. When the average velocity changes of the system goes below the threshold, the function [onStableVelo's handler](#neighbourSampling_latestForce) will be called. Set it to a number less than 0 or remove the [handler](#neighbourSampling_latestForce) to disable the threshold checking. If *threshold* is not specified, returns the current value, which defaults to 0.
+If *threshold* is specified, sets a threshold and returns this force. When the average velocity changes of the system goes below the threshold, the function [onStableVelo's handler](#neighbourSampling_latestForce) will be called. Set it to 0 or less or remove the [handler](#neighbourSampling_latestForce) to disable the threshold checking. If *threshold* is not specified, returns the current value, which defaults to 0.
# *neighbourSampling*.**onStableVelo**([*handler*])
-If *handler* is specified, sets the handler function which will be called at the end of each iteration if the average velocity changes of the system goes below the [threshold](#neighbourSampling_stableVelocity). To remove the handler, change it to null. If *threshold* is not specified, returns the current value, which defaults to null.
+If *handler* is specified, sets a handler function which will be called at the end of each iteration if the average velocity changes of the system goes below the [threshold](#neighbourSampling_stableVelocity), and returns this force. To remove the handler, change it to null. If *threshold* is not specified, returns the current value, which defaults to null.
### Hybrid Layout Simulation - TO WRITE