Re-write flow and API for hybrid, still broken
This commit is contained in:
@@ -9,33 +9,37 @@ function startHybridSimulation() {
|
||||
simulation.stop();
|
||||
p1 = performance.now();
|
||||
|
||||
configuration = {
|
||||
iteration: ITERATIONS,
|
||||
neighbourSize: NEIGHBOUR_SIZE,
|
||||
sampleSize: SAMPLE_SIZE,
|
||||
distanceRange: SELECTED_DISTANCE,
|
||||
fullIterations: FULL_ITERATIONS,
|
||||
fullNeighbourSize: FULL_NEIGHBOUR_SIZE,
|
||||
fullSampleSize: FULL_SAMPLE_SIZE,
|
||||
fullDistanceRange: FULL_SELECTED_DISTANCE,
|
||||
distanceFn: function (s, t) {return distanceFunction(s, t, props, norm);},
|
||||
pivots: PIVOTS,
|
||||
numPivots: NUM_PIVOTS
|
||||
};
|
||||
console.log(configuration);
|
||||
hybridSimulation = d3.hybridSimulation(nodes, configuration);
|
||||
function distance (s, t) {
|
||||
return distanceFunction(s, t, props, norm);
|
||||
}
|
||||
|
||||
let sample = hybridSimulation.sample();
|
||||
let remainder = hybridSimulation.remainder();
|
||||
let forceSample = d3.forceNeighbourSamplingDistance()
|
||||
.neighbourSize(NEIGHBOUR_SIZE)
|
||||
.sampleSize(SAMPLE_SIZE)
|
||||
.distance(distance)
|
||||
|
||||
addNodesToDOM(sample);
|
||||
let forceFull = d3.forceNeighbourSamplingDistance()
|
||||
.neighbourSize(FULL_NEIGHBOUR_SIZE)
|
||||
.sampleSize(FULL_SAMPLE_SIZE)
|
||||
.distance(distance)
|
||||
|
||||
hybridSimulation
|
||||
let hybridSimulation = d3.hybridSimulation(simulation, forceSample, forceFull)
|
||||
.sampleIterations(ITERATIONS)
|
||||
.fullIterations(FULL_ITERATIONS)
|
||||
.pivots(PIVOTS)
|
||||
.numPivots(NUM_PIVOTS)
|
||||
.interpFindTuneIts(INTERP_ENDING_ITS)
|
||||
.interpDistanceFn(distance)
|
||||
.on("sampleTick", ticked)
|
||||
.on("fullTick", ticked)
|
||||
.on("startFull", startedFull)
|
||||
.on("startInterp", startedFull)
|
||||
.on("end", ended);
|
||||
|
||||
let sample = hybridSimulation.sample();
|
||||
addNodesToDOM(sample);
|
||||
|
||||
hybridSimulation.restart();
|
||||
|
||||
function startedFull() {
|
||||
console.log("startedFull");
|
||||
d3.selectAll(".nodes").remove();
|
||||
|
||||
Reference in New Issue
Block a user