MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / collisions

Function collisions

graph-ui/src/galaxy/screen-node-spacing.ts:41–57  ·  view source on GitHub ↗
(x: number, y: number, radius: number)

Source from the content-addressed store, hash-verified

39 let left = Infinity, right = -Infinity, top = Infinity, bottom = -Infinity;
40
41 const collisions = (x: number, y: number, radius: number): Disk[] => {
42 const found: Disk[] = [];
43 for (const level of levels.values()) {
44 const cx = Math.floor(x / level.width), cy = Math.floor(y / level.width);
45 for (let ix = cx - 1; ix <= cx + 1; ix++) {
46 const column = level.columns.get(ix); if (!column) continue;
47 for (let iy = cy - 1; iy <= cy + 1; iy++) {
48 const bucket = column.get(iy); if (!bucket) continue;
49 for (const other of bucket) {
50 const dx = x - other.x, dy = y - other.y, distance = radius + other.radius;
51 if (dx * dx + dy * dy < distance * distance) found.push(other);
52 }
53 }
54 }
55 }
56 return found;
57 };
58
59 const insert = (disk: Disk, scale = disk.radius) => {
60 left = Math.min(left, disk.x - disk.radius); right = Math.max(right, disk.x + disk.radius);

Callers 1

separateScreenNodesFunction · 0.85

Calls 2

getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected