changed the floorplan (adjust stairs)
added the new stairs to the code changed the visualisation
This commit is contained in:
39
code/Vis.h
39
code/Vis.h
@@ -5,6 +5,7 @@
|
||||
#include <KLib/misc/gnuplot/GnuplotSplot.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotSplotElementLines.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotSplotElementPoints.h>
|
||||
#include <KLib/misc/gnuplot/GnuplotSplotElementColorPoints.h>
|
||||
|
||||
#include <Indoor/geo/Length.h>
|
||||
#include <Indoor/floorplan/Floor.h>
|
||||
@@ -16,8 +17,9 @@ public:
|
||||
K::Gnuplot gp;
|
||||
K::GnuplotSplot splot;
|
||||
K::GnuplotSplotElementLines floors;
|
||||
K::GnuplotSplotElementPoints gridNodes;
|
||||
K::GnuplotSplotElementColorPoints gridNodes;
|
||||
K::GnuplotSplotElementLines gridEdges;
|
||||
K::GnuplotSplotElementPoints particles;
|
||||
|
||||
public:
|
||||
|
||||
@@ -26,11 +28,13 @@ public:
|
||||
gp << "set hidden3d front\n";
|
||||
gp << "set view equal xy\n";
|
||||
gp << "set ticslevel 0\n";
|
||||
gp << "set cbrange[0.8:2.0]\n";
|
||||
|
||||
// attach all layers
|
||||
splot.add(&floors);
|
||||
splot.add(&gridNodes);
|
||||
splot.add(&gridEdges);
|
||||
splot.add(&particles);
|
||||
|
||||
}
|
||||
|
||||
@@ -50,13 +54,36 @@ public:
|
||||
|
||||
/** add the grid to the plot */
|
||||
template <typename T> Vis& addGrid(Grid<T>& grid) {
|
||||
|
||||
float max = 0;
|
||||
for (const T& n1 : grid) {
|
||||
if (n1.distToTarget > max) {max = n1.distToTarget;}
|
||||
}
|
||||
gp << "set cbrange[0.0:1.0]\n";
|
||||
//gp << "set cbrange[0.8:1.3]\n";
|
||||
|
||||
for (const T& n1 : grid) {
|
||||
const K::GnuplotPoint3 p1(n1.x_cm, n1.y_cm, n1.z_cm);
|
||||
gridNodes.add(p1);
|
||||
for (const T& n2 : grid.neighbors(n1)) {
|
||||
const K::GnuplotPoint3 p2(n2.x_cm, n2.y_cm, n2.z_cm);
|
||||
gridEdges.addSegment(p1, p2);
|
||||
}
|
||||
//const float color = n1.imp;
|
||||
//const float color = n1.distToTarget/max;
|
||||
const float color = 0;
|
||||
gridNodes.add(p1, color);
|
||||
// for (const T& n2 : grid.neighbors(n1)) {
|
||||
// const K::GnuplotPoint3 p2(n2.x_cm, n2.y_cm, n2.z_cm);
|
||||
// gridEdges.addSegment(p1, p2);
|
||||
// }
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void removeGrid() {
|
||||
gridNodes.clear();;
|
||||
}
|
||||
|
||||
template <typename T> Vis& showStates(std::vector<GridWalkState<T>>& states) {
|
||||
particles.clear();;
|
||||
for (const GridWalkState<T>& n : states) {
|
||||
particles.add(K::GnuplotPoint3(n.node->x_cm, n.node->y_cm, n.node->z_cm));
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user