new assertions

stair fixes
This commit is contained in:
2016-01-27 21:36:07 +01:00
parent 0e05f4bef8
commit c4ea811342
2 changed files with 6 additions and 2 deletions

View File

@@ -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 */
BBox2 shrinkAlign(const BBox2& bb) {
@@ -135,7 +139,7 @@ public:
/** add a new platform-stair between the two given floors */
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;
// add the platform in the middle