From 3a93c843c96d8a8f027aafb806db685df1884b92 Mon Sep 17 00:00:00 2001 From: Pitchaya Boonsarngsuk <2285135b@student.gla.ac.uk> Date: Sat, 13 Jan 2018 10:20:13 +0000 Subject: [PATCH] Completed cleanup run --- src/hybridSimulation.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/hybridSimulation.js b/src/hybridSimulation.js index 7299665..6d7e5c3 100644 --- a/src/hybridSimulation.js +++ b/src/hybridSimulation.js @@ -28,6 +28,7 @@ export default function (nodes, config) { var interpSubset = sampleFromNodes(sample, sample.length, Math.sqrt(sample.length)).sample; var sampleSimulation = d3.forceSimulation(sample) + .stop() .alphaDecay(1 - Math.pow(0.001, 1 / SAMPLE_ITERATIONS)); sampleSimulation @@ -38,38 +39,44 @@ export default function (nodes, config) { .force("neighbourSampling", neighbourSamplingDistance() .neighbourSize(neighbourSize) .sampleSize(sampleSize) + .distanceRange(distanceRange) .distance(distance) .multiplier(MULTIPLIER) ) - .stop() .alpha(1).restart(); function ended() { + console.log("Ended sample simulation"); + /* if (PIVOTS) { interpolationPivots(sample, remainder, interpSubset, NUMPIVOTS, distance); } else { interpolation(sample, remainder, interpSubset, distance); } - + */ + if (FULL_ITERATIONS==0) return; fullSimulation = d3.forceSimulation() + .stop() .alphaDecay(1 - Math.pow(0.001, 1 / FULL_ITERATIONS)); event.call("startFull", fullSimulation); fullSimulation - .force("neighbourSampling", d3.forceNeighbourSampling() - .distance(function (s, t) { - return distance(s, t, props, norm) * MULTIPLIER; - }) - .neighbourSize(neighbourSize) - .sampleSize(sampleSize)) - .nodes(nodes) + .force("neighbourSampling", neighbourSamplingDistance() + .neighbourSize(FullneighbourSize) + .sampleSize(FullsampleSize) + .distanceRange(FulldistanceRange) + .distance(distance) + .multiplier(MULTIPLIER) + ) .on("tick", function () { event.call("fullTick", fullSimulation); }) .on("end", function () { event.call("end", fullSimulation); - }); + }) + .nodes(nodes) + .alpha(1).restart(); } return hybrid = {