Revamp neighbor sampling, shredding unused features and correct calculations
This commit is contained in:
@@ -57,10 +57,8 @@ var MULTIPLIER = 50,
|
||||
FULL_ITERATIONS = 20,
|
||||
NODE_SIZE = 10,
|
||||
COLOR_ATTRIBUTE = "",
|
||||
SELECTED_DISTANCE = 10,
|
||||
FULL_NEIGHBOUR_SIZE = 6,
|
||||
FULL_SAMPLE_SIZE = 3,
|
||||
FULL_SELECTED_DISTANCE = 10;
|
||||
FULL_SAMPLE_SIZE = 3;
|
||||
|
||||
// Create a color scheme for a range of numbers.
|
||||
var color = d3.scaleOrdinal(d3.schemeCategory10);
|
||||
@@ -205,12 +203,12 @@ function ticked() {
|
||||
intercom.emit("passedData", simulation.force(forceName).distributionData());
|
||||
}
|
||||
if(alreadyRanIterations == ITERATIONS) {
|
||||
simulation.stop();
|
||||
ended();
|
||||
}
|
||||
}
|
||||
|
||||
function ended() {
|
||||
simulation.stop();
|
||||
console.log("ended");
|
||||
if (rendering !== true) { // Never drawn anything before? Now it's time.
|
||||
node
|
||||
|
||||
@@ -4,25 +4,24 @@
|
||||
function startNeighbourSamplingSimulation() {
|
||||
console.log("startNeighbourSamplingSimulation");
|
||||
//springForce = true;
|
||||
alreadyRanIterations = 0;
|
||||
simulation.stop();
|
||||
p1 = performance.now();
|
||||
|
||||
let force = d3.forceNeighbourSamplingDistance()
|
||||
.neighbourSize(NEIGHBOUR_SIZE)
|
||||
.sampleSize(SAMPLE_SIZE)
|
||||
.distance(function (s, t) {
|
||||
return distanceFunction(s, t, props, norm);
|
||||
})
|
||||
.stableVelocity(0.000001)
|
||||
.stableVeloHandler(ended);
|
||||
|
||||
simulation
|
||||
.alphaDecay(1 - Math.pow(0.001, 1 / ITERATIONS))
|
||||
.force(forceName, d3.forceNeighbourSamplingDistance()
|
||||
// Set the parameters for the algorithm (optional).
|
||||
.neighbourSize(NEIGHBOUR_SIZE)
|
||||
.sampleSize(SAMPLE_SIZE)
|
||||
// .freeness(0.5)
|
||||
// The distance function that will be used to calculate distances
|
||||
// between nodes.
|
||||
.distance(function (s, t) {
|
||||
return distanceFunction(s, t, props, norm);
|
||||
})
|
||||
.stableVelocity(0.004)
|
||||
.stableVeloHandler( function(){simulation.stop(); ended();} )
|
||||
);
|
||||
.alphaDecay(0)
|
||||
.alpha(1)
|
||||
.force(forceName, force);
|
||||
// Restart the simulation.
|
||||
console.log(simulation.force(forceName).neighbourSize(), simulation.force(forceName).sampleSize());
|
||||
simulation.alpha(1).restart();
|
||||
simulation.restart();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user