small changes so it works with yasmin

This commit is contained in:
toni
2018-07-19 10:29:51 +02:00
parent 74a424b555
commit db7c0e310e
5 changed files with 19 additions and 23 deletions

View File

@@ -50,21 +50,17 @@ namespace SMC {
for (uint32_t i = start; i < end; ++i) { for (uint32_t i = start; i < end; ++i) {
const int rnd = dist(gen); const int rnd = dist(gen);
particles[i] = particles[rnd]; particles[i] = particles[rnd];
particles[i].weight /= 2; //particles[i].weight /= 2;
particles[rnd].weight /= 2; //particles[rnd].weight /= 2;
} }
// calculate weight-sum // calculate weight-sum
double weightSum = 0; double weightSum = 0;
for (const auto& p : particles) { double equalweight = 1.0 / (double) cnt;
for (auto& p : particles) {
weightSum += p.weight; weightSum += p.weight;
p.weight = equalweight;
} }
int i = 0;
} }
private: private:

View File

@@ -77,8 +77,8 @@ namespace SMC {
// slight chance to get a truely random particle in range X m // slight chance to get a truely random particle in range X m
if (distNewOne(gen) < 0.001) { if (distNewOne(gen) < 0.001) {
const double radius = 50.0; const double radius = 50.0;
const NM::NavMeshSub<Tria> reachable(particlesCopy[i].state.pos, radius); const NM::NavMeshSub<Tria> reachable(particlesCopy[i].state.loc, radius);
particles[i].state.pos = reachable.getRandom().drawWithin(particlesCopy[i].state.pos.pos, radius); particles[i].state.loc = reachable.getRandom().drawWithin(particlesCopy[i].state.loc.pos, radius);
particles[i].weight = equalWeight; particles[i].weight = equalWeight;
continue; continue;
} }

View File

@@ -2,7 +2,7 @@
#include <fstream> #include <fstream>
#include "../../Tests.h" #include "../../Tests.h"
#include "../../../math/dsp/FIRComplex.h" #include "../../../math/dsp/fir/Complex.h"
#include <random> #include <random>