many changes and updates
- changed the wifi-estimation api - adjusted test-cases - worked on grid-bulding and grid-importance - new walking modules - fixed some minor issues
This commit is contained in:
18
grid/Grid.h
18
grid/Grid.h
@@ -221,13 +221,14 @@ public:
|
||||
Assert::isBetween((int32_t)p.y_cm, -max, +max, "y out of bounds");
|
||||
Assert::isBetween((int32_t)p.z_cm, -max, +max, "z out of bounds");
|
||||
|
||||
// shift by half of the allowed width of 20 bit to allow negative regions
|
||||
// shift by half of the allowed width of 20 bit to allow negative regions:
|
||||
// -> 19 bit positive and 19 bit negative
|
||||
const uint64_t center = 1 << 19;
|
||||
|
||||
// build
|
||||
const uint64_t x = std::round((p.x_cm+center) / (float)gridSize_cm);
|
||||
const uint64_t y = std::round((p.y_cm+center) / (float)gridSize_cm);
|
||||
const uint64_t z = std::round((p.z_cm+center) / (float)gridSize_cm * 5); // z is usually much lower and not always aligned -> allow more room for hashes
|
||||
const uint64_t x = center + (int64_t) std::round((p.x_cm) / (float)gridSize_cm);
|
||||
const uint64_t y = center + (int64_t) std::round((p.y_cm) / (float)gridSize_cm);
|
||||
const uint64_t z = center + (int64_t) std::round((p.z_cm) / (float)gridSize_cm * 5); // z is usually much lower and not always aligned -> allow more room for hashes
|
||||
|
||||
return (z << 40) | (y << 20) | (x << 0);
|
||||
|
||||
@@ -256,6 +257,11 @@ public:
|
||||
disconnectUniDir(n2, n1);
|
||||
}
|
||||
|
||||
/** remove the connection from n1 to n2 (not the other way round!) */
|
||||
void disconnectUniDir(const int idx1, const int idx2) {
|
||||
disconnectUniDir(nodes[idx1], nodes[idx2]);
|
||||
}
|
||||
|
||||
/** remove the connection from n1 to n2 (not the other way round!) */
|
||||
void disconnectUniDir(T& n1, T& n2) {
|
||||
for (int n = 0; n < n1._numNeighbors; ++n) {
|
||||
@@ -291,7 +297,11 @@ public:
|
||||
|
||||
// disconnect from all neighbors
|
||||
while (node._numNeighbors) {
|
||||
|
||||
// by removing one neighbor, all others are shifted to close the gap within the array
|
||||
// its therefor ok to always delete array index [0]
|
||||
disconnectBiDir(node._idx, node._neighbors[0]);
|
||||
|
||||
}
|
||||
|
||||
// remove from hash-list
|
||||
|
||||
Reference in New Issue
Block a user