added new data-structures

added new test-cases
added flexible dijkstra calculation
added debugging log
modified: plotting, grid-generation, grid-importance,
refactoring
This commit is contained in:
2016-01-22 18:47:06 +01:00
parent 12084fe147
commit cdf97322f8
21 changed files with 720 additions and 141 deletions

36
math/MiniMat2.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef MINIMAT2_H
#define MINIMAT2_H
/**
* very simple 2x2 matrix
*/
struct MiniMat2 {
/** store eigenvalues */
struct EV {float e1,e2;};
/** data */
float a,b,c,d;
/** ctor */
MiniMat2() : a(0), b(0), c(0), d(0) {;}
/** get the matrix' eigenvalues */
EV getEigenvalues() const {
const float T = a+d;
const float D = a*d - b*c;
EV res;
res.e1 = T/2 + std::sqrt(T*T/4-D);
res.e2 = T/2 - std::sqrt(T*T/4-D);
return res;
}
/** add (x,y) * (x,y)T to the matrix */
void addSquared(const float x, const float y) {
a += (x*x); b += (x*y);
c += (x*y); d += (y*y);
}
};
#endif // MINIMAT2_H