change project structure, add GridIndex

This commit is contained in:
2025-09-09 11:26:20 -05:00
parent dcde94c7a8
commit 769ed878d6
5 changed files with 64 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
function generateRealisticLabel() {
return crypto.randomUUID().substring(0, 8);
}
function calculateDistance(node1, node2) {
return Math.sqrt((node1.x - node2.x) ** 2 + (node1.y - node2.y) ** 2);
}
function connectNodes(node1, node2) {
if (edges.get(`${node1}->${node2}`) || edges.get(`${node2}->${node1}`)) {
return;
}
const edgeId = `${node1}->${node2}`;
edges.add({
id: edgeId,
from: node1,
to: node2,
});
edges.add({
id: `${node2}->${node1}`,
from: node2,
to: node1,
});
}
function distanceToRSSI(distance) {
return -10 - 26 * Math.log10(distance);
}