diff --git a/examples/d3-force-neighbourSampling-papaparsing.html b/examples/d3-force-neighbourSampling-papaparsing.html index a6b172c..71b828b 100644 --- a/examples/d3-force-neighbourSampling-papaparsing.html +++ b/examples/d3-force-neighbourSampling-papaparsing.html @@ -312,4 +312,4 @@ - \ No newline at end of file + diff --git a/examples/js/src/neighbourSampling-papaparsing.js b/examples/js/src/neighbourSampling-papaparsing.js index a133a39..74f4f7c 100644 --- a/examples/js/src/neighbourSampling-papaparsing.js +++ b/examples/js/src/neighbourSampling-papaparsing.js @@ -354,23 +354,11 @@ function startHybridSimulation() { hybridSimulation - .on("sampleTick", tickedHybrid) - .on("fullTick", tickedHybrid) + .on("sampleTick", ticked) + .on("fullTick", ticked) .on("startFull", startedFull) .on("end", endedHybrid); - function tickedHybrid() { - if (rendering === true) { - node - .attr("cx", function (d) { - return d.x; - }) - .attr("cy", function (d) { - return d.y; - }); - } - } - function startedFull() { d3.selectAll(".nodes").remove(); // Add the nodes to DOM. diff --git a/src/hybridSimulation.js b/src/hybridSimulation.js index 961010f..98c0c69 100644 --- a/src/hybridSimulation.js +++ b/src/hybridSimulation.js @@ -48,11 +48,13 @@ export default function (nodes, config) { function ended() { event.call("startFull"); console.log("Ended sample simulation"); + alert('About to interpolate'); + interpolation(sample, remainder, sampleSubset, distanceFn); /* if (PIVOTS) { - interpolationPivots(sample, remainder, interpSubset, NUMPIVOTS, distance); + interpolationPivots(sample, remainder, sampleSubSet, NUMPIVOTS, distance); } else { - interpolation(sample, remainder, interpSubset, distance); + interpolation(sample, remainder, sampleSubSet, distance); } */ event.call("fullTick"); @@ -72,6 +74,8 @@ export default function (nodes, config) { .sampleSize(FullsampleSize) .distanceRange(FulldistanceRange) .distance(distanceFn) + .stableVelocity(60) + .stableVeloHandler(function(){fullSimulation.stop(); event.call("end");}) ) .on("tick", function () { event.call("fullTick", fullSimulation); diff --git a/src/interpolation.js b/src/interpolation.js index 28356a0..9b7146d 100644 --- a/src/interpolation.js +++ b/src/interpolation.js @@ -64,7 +64,7 @@ function placeNearToNearestNeighbour(node, minNode, radius, sampleSubset, realDi let angle = binarySearchMin(lowBound, highBound, function(angle){ - return sumDistError(pointOnCircle(minNode.x, minNode.y, angle, radius), samples, realDistances); + return sumDistError(pointOnCircle(minNode.x, minNode.y, angle, radius), sampleSubset, realDistances); }); let newPoint = pointOnCircle(minNode.x, minNode.y, angle, radius); diff --git a/src/neighbourSamplingDistance.js b/src/neighbourSamplingDistance.js index 37eeae8..4c20b56 100644 --- a/src/neighbourSamplingDistance.js +++ b/src/neighbourSamplingDistance.js @@ -57,7 +57,7 @@ export default function () { findNewNeighbours(i); } velocity /= nodes.length*alpha; - // Now total velocity change per node, alpha not considered + // Now total velocity changes per node, alpha not considered if(Math.abs(velocity)