huge commit
- worked on about everything - grid walker using plugable modules - wifi models - new distributions - worked on geometric data-structures - added typesafe timestamps - worked on grid-building - added sensor-classes - added sensor analysis (step-detection, turn-detection) - offline data reader - many test-cases
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "../Math.h"
|
||||
#include "../DrawList.h"
|
||||
|
||||
namespace Distribution {
|
||||
|
||||
@@ -38,6 +39,29 @@ namespace Distribution {
|
||||
return samples[idx];
|
||||
}
|
||||
|
||||
/** get a DrawList for this LUT to draw random values out of it */
|
||||
DrawList<Scalar> getDrawList() {
|
||||
DrawList<Scalar> dl;
|
||||
for (int idx = 0; idx < (int) samples.size(); ++idx) {
|
||||
const Scalar val = idxToVal(idx);
|
||||
const Scalar prob = samples[idx];
|
||||
dl.add(val, prob);
|
||||
}
|
||||
return dl;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/** convert value [min:max] to index [0:numSamples] */
|
||||
inline int valToIdx(const Scalar val) const {
|
||||
return ((val - min) * numSamples / diff);
|
||||
}
|
||||
|
||||
/** convert index [0:numSamples] to value [min:max] */
|
||||
inline Scalar idxToVal(const int idx) const {
|
||||
return min + (idx * diff / numSamples);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** build the look-up-table */
|
||||
|
||||
Reference in New Issue
Block a user