moved from ray3 to floorplan/3D
worked on new wall models refactoring
This commit is contained in:
51
floorplan/3D/Pillars.h
Normal file
51
floorplan/3D/Pillars.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef FLOORPLAN_3D_PILLARS_H
|
||||
#define FLOORPLAN_3D_PILLARS_H
|
||||
|
||||
#include "Obstacle3.h"
|
||||
#include "misc.h"
|
||||
#include "primitives/Cylinder.h"
|
||||
|
||||
namespace Floorplan3D {
|
||||
|
||||
class Pillars {
|
||||
|
||||
public:
|
||||
|
||||
std::vector<Obstacle3D> getPillars(const Floorplan::Floor* f) {
|
||||
std::vector<Obstacle3D> res;
|
||||
for (const Floorplan::FloorObstacle* o: f->obstacles) {
|
||||
const Floorplan::FloorObstacleCircle* circ = dynamic_cast<const Floorplan::FloorObstacleCircle*>(o);
|
||||
if (circ) {
|
||||
res.push_back(getPillar(f, circ));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Obstacle3D getPillar(const Floorplan::Floor* f, const Floorplan::FloorObstacleCircle* foc) {
|
||||
|
||||
FloorPos fpos(f);
|
||||
|
||||
// attributes
|
||||
const float r = foc->radius;
|
||||
const float h = (foc->height > 0) ? (foc->height) : (fpos.height); // use either floor's height or user height
|
||||
const Point3 pos(foc->center.x, foc->center.y, fpos.z1 + h/2);
|
||||
|
||||
// build
|
||||
Cylinder cyl;
|
||||
cyl.add(r, h/2, true);
|
||||
cyl.translate(pos);
|
||||
|
||||
// done
|
||||
Obstacle3D res(getType(foc), foc->material);
|
||||
res.triangles = cyl.getTriangles();
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // FLOORPLAN_3D_PILLARS_H
|
||||
Reference in New Issue
Block a user