Add comments
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
import {pointOnCircle, takeSampleFrom} from "./helpers";
|
||||
import {placeNearToNearestNeighbour} from "./interpCommon";
|
||||
|
||||
/**
|
||||
* Perform interpolation where the nearest neighbour is found by brute-force.
|
||||
* For each point to be interpolated:
|
||||
* - Phase 1: find a nearest beighbour by comparing high-d distance against
|
||||
each point already in the graph.
|
||||
* - Phase 2 and 3 are passed onto placeNearToNearestNeighbour
|
||||
* @param {list} sampleSet - nodes already plotted on the 2D graph
|
||||
* @param {list} remainderSet - nodes to be interpolated onto the graph
|
||||
* @param {function} distanceFn - f(nodex, nodey) that calculate high-dimensional
|
||||
* distance between 2 nodes
|
||||
* @param {number} endingIts - for phase 3, how many iterations to refine the
|
||||
* placement of each interpolated point
|
||||
*/
|
||||
export default function(sampleSet, remainderSet, distanceFn) {
|
||||
// var distance = calculateEuclideanDistance;
|
||||
// console.log("Brute-force");
|
||||
let sampleSubset = takeSampleFrom(sampleSet, Math.sqrt(sampleSet.length)).sample;
|
||||
|
||||
for (let node of remainderSet) {
|
||||
|
||||
Reference in New Issue
Block a user