added floorplan support for object-sizing
added floorplan support for different wall-heights minor fixes/changes
This commit is contained in:
@@ -349,8 +349,9 @@ namespace Floorplan {
|
||||
Point2 from;
|
||||
Point2 to;
|
||||
float thickness_m;
|
||||
FloorObstacleLine(const ObstacleType type, const Material material, const Point2 from, const Point2 to, const float thickness_m = 0.2f) : FloorObstacle(material), type(type), from(from), to(to), thickness_m(thickness_m) {;}
|
||||
FloorObstacleLine(const ObstacleType type, const Material material, const float x1, const float y1, const float x2, const float y2, const float thickness_m = 0.2f) : FloorObstacle(material), type(type), from(x1,y1), to(x2,y2), thickness_m(thickness_m) {;}
|
||||
float height_m = 0; // 0 = floor's height
|
||||
FloorObstacleLine(const ObstacleType type, const Material material, const Point2 from, const Point2 to, const float thickness_m = 0.2f, const float height_m = 0) : FloorObstacle(material), type(type), from(from), to(to), thickness_m(thickness_m), height_m(height_m) {;}
|
||||
FloorObstacleLine(const ObstacleType type, const Material material, const float x1, const float y1, const float x2, const float y2, const float thickness_m = 0.2f, const float height_m = 0) : FloorObstacle(material), type(type), from(x1,y1), to(x2,y2), thickness_m(thickness_m), height_m(height_m) {;}
|
||||
};
|
||||
|
||||
/** circle obstacle */
|
||||
@@ -380,7 +381,8 @@ namespace Floorplan {
|
||||
std::string file;
|
||||
Point3 pos;
|
||||
Point3 rot;
|
||||
FloorObstacleObject(const std::string& file, const Point3 pos, const Point3 rot) : file(file), pos(pos), rot(rot) {;}
|
||||
Point3 scale = Point3(1,1,1);
|
||||
FloorObstacleObject(const std::string& file, const Point3 pos, const Point3 rot, const Point3 scale) : file(file), pos(pos), rot(rot), scale(scale) {;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -403,7 +403,8 @@ namespace Floorplan {
|
||||
parseMaterial(el->Attribute("material")),
|
||||
el->FloatAttribute("x1"), el->FloatAttribute("y1"),
|
||||
el->FloatAttribute("x2"), el->FloatAttribute("y2"),
|
||||
(el->FloatAttribute("thickness") > 0) ? (el->FloatAttribute("thickness")) : (0.15) // default wall thickness in m
|
||||
(el->FloatAttribute("thickness") > 0) ? (el->FloatAttribute("thickness")) : (0.15), // default wall thickness in m
|
||||
el->FloatAttribute("height")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -433,7 +434,8 @@ namespace Floorplan {
|
||||
return new FloorObstacleObject(
|
||||
el->Attribute("file"),
|
||||
Point3(el->FloatAttribute("x"), el->FloatAttribute("y"), el->FloatAttribute("z")),
|
||||
Point3(el->FloatAttribute("rx"), el->FloatAttribute("ry"), el->FloatAttribute("rz"))
|
||||
Point3(el->FloatAttribute("rx", 0), el->FloatAttribute("ry", 0), el->FloatAttribute("rz", 0)),
|
||||
Point3(el->FloatAttribute("sx", 1), el->FloatAttribute("sy", 1), el->FloatAttribute("sz", 1))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -334,6 +334,7 @@ namespace Floorplan {
|
||||
obstacle->SetAttribute("x2", line->to.x);
|
||||
obstacle->SetAttribute("y2", line->to.y);
|
||||
obstacle->SetAttribute("thickness", line->thickness_m);
|
||||
if (line->height_m != 0) {obstacle->SetAttribute("height", line->height_m);}
|
||||
obstacles->InsertEndChild(obstacle);
|
||||
}
|
||||
|
||||
@@ -344,7 +345,7 @@ namespace Floorplan {
|
||||
obstacle->SetAttribute("cx", circle->center.x);
|
||||
obstacle->SetAttribute("cy", circle->center.y);
|
||||
obstacle->SetAttribute("radius", circle->radius);
|
||||
obstacle->SetAttribute("height", circle->height);
|
||||
if (circle->height != 0) {obstacle->SetAttribute("height", circle->height);}
|
||||
obstacles->InsertEndChild(obstacle);
|
||||
}
|
||||
|
||||
@@ -369,9 +370,12 @@ namespace Floorplan {
|
||||
obstacle->SetAttribute("x", obj->pos.x);
|
||||
obstacle->SetAttribute("y", obj->pos.y);
|
||||
obstacle->SetAttribute("z", obj->pos.z);
|
||||
obstacle->SetAttribute("rx", obj->rot.x);
|
||||
obstacle->SetAttribute("ry", obj->rot.y);
|
||||
obstacle->SetAttribute("rz", obj->rot.z);
|
||||
if (obj->rot.x != 0) {obstacle->SetAttribute("rx", obj->rot.x);}
|
||||
if (obj->rot.y != 0) {obstacle->SetAttribute("ry", obj->rot.y);}
|
||||
if (obj->rot.z != 0) {obstacle->SetAttribute("rz", obj->rot.z);}
|
||||
if (obj->scale.x != 1) {obstacle->SetAttribute("sx", obj->scale.x);}
|
||||
if (obj->scale.y != 1) {obstacle->SetAttribute("sy", obj->scale.y);}
|
||||
if (obj->scale.z != 1) {obstacle->SetAttribute("sz", obj->scale.z);}
|
||||
obstacles->InsertEndChild(obstacle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user