MCPcopy Create free account
hub / github.com/microsoft/SandDance / updateInterval

Function updateInterval

docs/tests/v2/es6/js/sanddance.js:88046–88058  ·  view source on GitHub ↗
(xv, i, interval)

Source from the content-addressed store, hash-verified

88044
88045
88046function updateInterval(xv, i, interval) {
88047 let val = xv[i],
88048 left = interval[0],
88049 right = interval[1] + 1;
88050 if (right >= xv.length) return; // step right if distance to new right edge is <= distance to old left edge
88051 // step when distance is equal to ensure movement over duplicate x values
88052
88053 while (i > left && xv[right] - val <= val - xv[left]) {
88054 interval[0] = ++left;
88055 interval[1] = right;
88056 ++right;
88057 }
88058} // generate smoothed output points
88059// average points with repeated x values
88060
88061

Callers 1

_defaultFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected