fixed issues and elevators
This commit is contained in:
15
grid/Grid.h
15
grid/Grid.h
@@ -231,14 +231,23 @@ public:
|
||||
const uint64_t center = 1 << 19;
|
||||
|
||||
// build
|
||||
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
|
||||
const uint64_t x = center + (int64_t) idxX(p.x_cm);
|
||||
const uint64_t y = center + (int64_t) idxY(p.y_cm);
|
||||
const uint64_t z = center + (int64_t) idxZ(p.z_cm);
|
||||
|
||||
return (z << 40) | (y << 20) | (x << 0);
|
||||
|
||||
}
|
||||
|
||||
inline int idxX(const int x_cm) const {return std::round(x_cm / (float)gridSize_cm);}
|
||||
inline int idxY(const int y_cm) const {return std::round(y_cm / (float)gridSize_cm);}
|
||||
inline int idxZ(const int z_cm) const {return std::round(z_cm / (float)gridSize_cm);} // * 5?? // z is usually much lower and not always aligned -> allow more room for hashes
|
||||
|
||||
inline int snapX(const int x_cm) const {return std::round(x_cm / (float)gridSize_cm) * gridSize_cm;}
|
||||
inline int snapY(const int y_cm) const {return std::round(y_cm / (float)gridSize_cm) * gridSize_cm;}
|
||||
inline int snapZ(const int z_cm) const {return std::round(z_cm / (float)gridSize_cm) * gridSize_cm;} // * 5?? // z is usually much lower and not always aligned -> allow more room for hashes
|
||||
|
||||
|
||||
/** array access */
|
||||
T& operator [] (const int idx) {
|
||||
Assert::isBetween(idx, 0, getNumNodes()-1, "index out of bounds");
|
||||
|
||||
Reference in New Issue
Block a user