MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / lowerBoundTuple

Function lowerBoundTuple

src/interaction/findNearestPoint.ts:427–440  ·  view source on GitHub ↗
(
  data: ReadonlyArray<TuplePoint>,
  xTarget: number,
)

Source from the content-addressed store, hash-verified

425}
426
427const lowerBoundTuple = (
428 data: ReadonlyArray<TuplePoint>,
429 xTarget: number,
430): number => {
431 let lo = 0;
432 let hi = data.length;
433 while (lo < hi) {
434 const mid = (lo + hi) >>> 1;
435 const x = data[mid][0];
436 if (x < xTarget) lo = mid + 1;
437 else hi = mid;
438 }
439 return lo;
440};
441
442const lowerBoundObject = (
443 data: ReadonlyArray<ObjectPoint>,

Callers 1

findNearestPointFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected