worked on nav-mesh
added dijkstra support for nav mesh some minor changes to distributions minor fixes
This commit is contained in:
@@ -11,5 +11,6 @@
|
||||
#include "distribution/NormalN.h"
|
||||
#include "distribution/Rectangular.h"
|
||||
#include "distribution/NormalCDF.h"
|
||||
#include "distribution/Const.h"
|
||||
|
||||
#endif // DISTRIBUTIONS_H
|
||||
|
||||
@@ -1,4 +1,28 @@
|
||||
#ifndef CONST_H
|
||||
#define CONST_H
|
||||
#ifndef DISTRIBUTION_CONST_H
|
||||
#define DISTRIBUTION_CONST_H
|
||||
|
||||
#endif // CONST_H
|
||||
|
||||
namespace Distribution {
|
||||
|
||||
/** uniform distribution */
|
||||
template <typename T> class Const {
|
||||
|
||||
const T val;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
Const(const T val) : val(val) {
|
||||
|
||||
}
|
||||
|
||||
/** get a constant value */
|
||||
T draw() {
|
||||
return val;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // DISTRIBUTION_CONST_H
|
||||
|
||||
@@ -25,9 +25,11 @@ namespace Distribution {
|
||||
/** ctor */
|
||||
Normal(const T mu, const T sigma) :
|
||||
mu(mu), sigma(sigma), _a(1.0 / (sigma * std::sqrt(2.0 * M_PI))), gen(RANDOM_SEED), dist(mu,sigma) {
|
||||
}
|
||||
|
||||
#warning "analyze issue when coping an existing distribution and using draw() afterwards. this seems to yield issues"
|
||||
|
||||
/** ctor with seed */
|
||||
Normal(const T mu, const T sigma, const uint32_t seed) :
|
||||
mu(mu), sigma(sigma), _a(1.0 / (sigma * std::sqrt(2.0 * M_PI))), gen(seed), dist(mu,sigma) {
|
||||
}
|
||||
|
||||
/** do not allow copy. this will not work as expected for std::normal_distribution when using draw() ?! */
|
||||
|
||||
@@ -27,6 +27,12 @@ namespace Distribution {
|
||||
Uniform(const T min, const T max) : gen(RANDOM_SEED), dist(min, max) {
|
||||
|
||||
}
|
||||
|
||||
/** ctor with seed */
|
||||
Uniform(const T min, const T max, const uint32_t seed) : gen(seed), dist(min, max) {
|
||||
|
||||
}
|
||||
|
||||
/** get a uniformaly distributed random number */
|
||||
T draw() {
|
||||
return dist(gen);
|
||||
|
||||
Reference in New Issue
Block a user