current TeX

minor code changes for GFX
This commit is contained in:
2017-05-02 17:01:21 +02:00
parent 8596732f43
commit 47def9ad90
7 changed files with 281 additions and 95 deletions

View File

@@ -50,17 +50,19 @@ public:
/**
* plot the error for every fingerprint
*/
template <typename Model> void showErrorPerFingerprint(const std::string& modelParamsXML, const WiFiFingerprints& fps) {
template <typename Model> Plotty* showErrorPerFingerprint(const std::string& modelParamsXML, const WiFiFingerprints& fps) {
Plotty* plot = new Plotty(map);
plot->settings.obstacles = true;
plot->settings.outline = false;
plot->settings.stairs = false;
plot->settings.outlineColorCustom = true;
plot->settings.outlineColor = K::GnuplotColor::fromRGB(0,0,0);
plot->buildFloorplan();
plot->equalXY();
//plot.gp << "unset border\n";
plot->gp << "unset border\n";
plot->splot.getAxisX().setTicsVisible(false);
plot->splot.getAxisY().setTicsVisible(false);
plot->splot.getAxisZ().setTicsVisible(false);
@@ -109,6 +111,9 @@ public:
}
// enqueue AVG error
//errors.push_back(ErrPoint(fp.pos_m, errAbs.getAvg()));
// enqueue MAX error
errors.push_back(ErrPoint(fp.pos_m, errAbs.getMax()));
}
@@ -117,7 +122,7 @@ public:
std::vector<ErrPoint> errorsInt;
K::Statistics<float> errStats;
const float oz = 1.3;
const float ss = 1.5;
const float ss = 4.0;
for (Floorplan::Floor* floor : map->floors) {
@@ -175,22 +180,23 @@ public:
}
const float minErr = 0.0;//errStats.getMin();
const float maxErr = 18.0;//errStats.getQuantile(0.9);
const float maxErr = 20.0;//errStats.getQuantile(0.9);
plot->splot.setTitle("max error: " + std::to_string(errStats.getQuantile(0.9)) + " dB");
//plot->splot.setTitle("max error: " + std::to_string(errStats.getMax()) + " dB");
// draw interpolated errors between min/max
for (const ErrPoint& ep : errorsInt) {
float factor = (ep.err - minErr) / (maxErr-minErr);
if (factor > 1) {factor = 1;}
if (factor < 0) {factor = 0;}
// hsv green->yellow->red
// const float h = 90 * (1 - std::pow(factor, 1.0));
// K::GnuplotColor color = K::GnuplotColor::fromHSV(h, 255, 255);
// hsv white->red
const float sat = 255 * (std::pow(factor, 1.5));
const float sat = 255 * factor;
K::GnuplotColor color = K::GnuplotColor::fromHSV(0, sat, 255);
K::GnuplotObjectPolygon* poly = new K::GnuplotObjectPolygon(
@@ -205,13 +211,16 @@ public:
poly->add(K::GnuplotCoordinate3(ep.pos.x+s, ep.pos.y+s, ep.pos.z-oz, K::GnuplotCoordinateSystem::FIRST));
poly->add(K::GnuplotCoordinate3(ep.pos.x-s, ep.pos.y+s, ep.pos.z-oz, K::GnuplotCoordinateSystem::FIRST));
poly->close();
poly->setZIndex(ep.pos.z);
poly->setZIndex(ep.pos.z - 1.5);
plot->splot.getObjects().add(poly);
}
plot->splot.getObjects().reOrderByZIndex();
plot->plot();
return plot;
}
};