added floorplan support for object-sizing

added floorplan support for different wall-heights
minor fixes/changes
This commit is contained in:
k-a-z-u
2018-07-04 20:28:15 +02:00
parent fb8061125f
commit 19d9ce3961
10 changed files with 58 additions and 18 deletions

View File

@@ -52,6 +52,7 @@ private:
bool _buildStairs = true;
bool _removeIsolated = true;
bool _addTightToObstacle = false;
bool _abortOnError = true;
public:
@@ -60,6 +61,8 @@ public:
}
void setAbortOnError(const bool abort) {this->_abortOnError = abort;}
void setAddTightToObstacle(const bool tight) {this->_addTightToObstacle = tight;}
/** whether or not to build stairs */
@@ -181,7 +184,9 @@ public:
// belongs to a "add" polygon? -> remember until all polygons were checked
// [might still belong to a "remove" polygon]
res.outdoor = poly->outdoor;
if (poly->outdoor) {
res.outdoor = true; // belonging to an outdoor region overwrites all other belongings
}
}
}
@@ -219,7 +224,7 @@ public:
if (foo) {
// get the obstacle
const Ray3D::Obstacle3D obs = Ray3D::OBJPool::get().getObject(foo->file).rotated_deg(foo->rot).translated(foo->pos);
const Ray3D::Obstacle3D obs = Ray3D::OBJPool::get().getObject(foo->file).scaled(foo->scale).rotated_deg(foo->rot).translated(foo->pos);
// construct its 2D convex hull (in centimter)
HelperPoly poly;
@@ -295,6 +300,8 @@ public:
void buildStairs(const Floorplan::IndoorMap* map, const Floorplan::Floor* floor, GridFactoryListener* listener = nullptr) {
stairs.setAbortOnError(_abortOnError);
const int total = floor->stairs.size();
int cur = 0;

View File

@@ -32,6 +32,7 @@ private:
std::vector<T*> toDelete;
bool tryImproveStairConnections = true;
bool abortOnError = true;
private:
@@ -47,7 +48,6 @@ private:
StairNode(const int x_cm, const int y_cm, const int quadIdx) : x_cm(x_cm), y_cm(y_cm), belongsToQuadIdx(quadIdx) {;}
};
@@ -62,7 +62,10 @@ public:
finalize();
}
/** whether to abort when errors are detected */
void setAbortOnError(const bool abort) {
this->abortOnError = abort;
}
@@ -184,7 +187,11 @@ public:
// be sure both are connected to a floor
if (!end1OK || !end2OK) {
throw Exception("stair's start or end is not directly connectable to a floor");
if (abortOnError) {
throw Exception("stair's start or end is not directly connectable to a floor");
} else{
std::cout << "stair's start or end is not directly connectable to a floor" << std::endl;
}
}
}