added fixed interval smoothing

This commit is contained in:
toni
2016-03-17 19:24:45 +01:00
parent 8d2be0f8a0
commit 89bb0b8b7a
17 changed files with 1010 additions and 137 deletions

View File

@@ -47,8 +47,9 @@ public:
}
/** align the given value onto the grid */
static int align(const int val) {
return val / MiscSettings::gridSize_cm * MiscSettings::gridSize_cm;
template <typename T> static int align(Grid<T>& grid, const int val) {
volatile const float gridSize_cm = grid.getGridSize_cm();
return std::round(val / gridSize_cm) * gridSize_cm;
}
/** all floors within the building */
@@ -58,23 +59,20 @@ public:
Stairs s01, s12, s23;
const LengthF h0 = LengthF::cm(align(getHeight(0)));
const LengthF h1 = LengthF::cm(align(getHeight(1)));
const LengthF h2 = LengthF::cm(align(getHeight(2)));
const LengthF h3 = LengthF::cm(align(getHeight(3)));
LengthF h0, h1, h2, h3;
// all ground-truth points
std::unordered_map<int, Point3> gtwp;
FHWSFloors() {;}
FHWSFloors(LengthF h0, LengthF h1, LengthF h2, LengthF h3) : h0(h0), h1(h1), h2(h2), h3(h3) {;}
};
/** load the entire floorplan */
static FHWSFloors getFloors() {
template <typename T> static FHWSFloors getFloors(Grid<T>& grid) {
FloorplanFactorySVG fpFac(MiscSettings::floorplan, 2.822222);
FHWSFloors f;
FHWSFloors f(LengthF::cm(align(grid, getHeight(0))), LengthF::cm(align(grid, getHeight(1))), LengthF::cm(align(grid, getHeight(2))), LengthF::cm(align(grid, getHeight(3))));
f.f0 = fpFac.getFloor("floor_0");
f.f1 = fpFac.getFloor("floor_1");