MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / buildGrid

Function buildGrid

dashboard/holographic/src/semanticMap/hitTest.ts:13–22  ·  view source on GitHub ↗
(placed: PlacedPoint[])

Source from the content-addressed store, hash-verified

11}
12
13export function buildGrid(placed: PlacedPoint[]): Map<string, number[]> {
14 const grid = new Map<string, number[]>();
15 placed.forEach((p, i) => {
16 const key = `${Math.floor(p.x / GRID_CELL)},${Math.floor(p.y / GRID_CELL)}`;
17 const cell = grid.get(key);
18 if (cell) cell.push(i);
19 else grid.set(key, [i]);
20 });
21 return grid;
22}
23
24export function findNearest(
25 placed: PlacedPoint[],

Callers 1

SemanticMapFunction · 0.90

Calls 2

pushMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected