Attempts to align prior data with new data, based on a provided similarity function.
See also alignById for a version which encloses parameters.
alignById
// Compare data based on x,y distanceconst fn = (a, b) => { return 1-Points.distance(a, b);}const lastData = [ { id:`1`, x:100, y:200 } ...]const newData = [ { id:`2`, x:101, y:200 }]const aligned = Correlate.align(fn, lastdata, newData, opts);// Result:[ { id:`1`, x:101, y:200 }] Copy
// Compare data based on x,y distanceconst fn = (a, b) => { return 1-Points.distance(a, b);}const lastData = [ { id:`1`, x:100, y:200 } ...]const newData = [ { id:`2`, x:101, y:200 }]const aligned = Correlate.align(fn, lastdata, newData, opts);// Result:[ { id:`1`, x:101, y:200 }]
Function to compute similarity
Old data
New data
Options
Attempts to align prior data with new data, based on a provided similarity function.
See also
alignById
for a version which encloses parameters.