new assertions
stair fixes
This commit is contained in:
@@ -154,7 +154,7 @@ public:
|
|||||||
/** get the center-node the given Point belongs to */
|
/** get the center-node the given Point belongs to */
|
||||||
const T& getNodeFor(const GridPoint& p) {
|
const T& getNodeFor(const GridPoint& p) {
|
||||||
const UID uid = getUID(p);
|
const UID uid = getUID(p);
|
||||||
if (hashes.find(uid) == hashes.end()) {throw Exception("element not found!");}
|
Assert::isTrue(hashes.find(uid) != hashes.end(), "element not found!");
|
||||||
return nodes[hashes[uid]];
|
return nodes[hashes[uid]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float align(const float val) {
|
||||||
|
const float gridSize_cm = grid.getGridSize_cm();
|
||||||
|
return std::round(val/gridSize_cm) * gridSize_cm;
|
||||||
|
}
|
||||||
|
|
||||||
/** shrink the given bbox to be grid-aligned */
|
/** shrink the given bbox to be grid-aligned */
|
||||||
BBox2 shrinkAlign(const BBox2& bb) {
|
BBox2 shrinkAlign(const BBox2& bb) {
|
||||||
@@ -135,7 +139,7 @@ public:
|
|||||||
/** add a new platform-stair between the two given floors */
|
/** add a new platform-stair between the two given floors */
|
||||||
void buildPlatformStair(const PlatformStair& s, const float z1_cm, const float z2_cm) {
|
void buildPlatformStair(const PlatformStair& s, const float z1_cm, const float z2_cm) {
|
||||||
|
|
||||||
const float zCenter_cm = (z2_cm + z1_cm) / 2;
|
const float zCenter_cm = align((z2_cm + z1_cm) / 2);
|
||||||
std::vector<int> indices;
|
std::vector<int> indices;
|
||||||
|
|
||||||
// add the platform in the middle
|
// add the platform in the middle
|
||||||
|
|||||||
Reference in New Issue
Block a user