From db7c0e310ef6c7278905c8906a2bb6f37d1775a9 Mon Sep 17 00:00:00 2001 From: toni Date: Thu, 19 Jul 2018 10:29:51 +0200 Subject: [PATCH] small changes so it works with yasmin --- navMesh/walk/NavMeshWalkSimple.h | 10 +++++----- .../resampling/ParticleFilterResampling.h | 8 ++++---- .../ParticleFilterResamplingPercent.h | 18 +++++++----------- ...ticleFilterResamplingSimpleImpoverishment.h | 4 ++-- tests/math/dsp/TestFIRComplex.cpp | 2 +- 5 files changed, 19 insertions(+), 23 deletions(-) diff --git a/navMesh/walk/NavMeshWalkSimple.h b/navMesh/walk/NavMeshWalkSimple.h index 8487be3..c224427 100644 --- a/navMesh/walk/NavMeshWalkSimple.h +++ b/navMesh/walk/NavMeshWalkSimple.h @@ -73,15 +73,15 @@ namespace NM { // is above destination reachable? if (dstTria) { - re.heading = params.heading; // heading was OK -> keep - re.location.pos = dstTria->toPoint3(dst); // new destination position - re.location.tria = dstTria; // new destination triangle + re.heading = params.heading; // heading was OK -> keep + re.location.pos = dstTria->toPoint3(dst); // new destination position + re.location.tria = dstTria; // new destination triangle ++hits; } else { - NavMeshRandom rnd = reachable.getRandom(); // random-helper - re.location = rnd.draw(); // get a random destianation + NavMeshRandom rnd = reachable.getRandom(); // random-helper + re.location = rnd.draw(); // get a random destianation re.heading = Heading(params.start.pos.xy(), re.location.pos.xy()); // update the heading ++misses; diff --git a/smc/filtering/resampling/ParticleFilterResampling.h b/smc/filtering/resampling/ParticleFilterResampling.h index 906e91f..b62bfc3 100644 --- a/smc/filtering/resampling/ParticleFilterResampling.h +++ b/smc/filtering/resampling/ParticleFilterResampling.h @@ -24,10 +24,10 @@ namespace SMC { public: - /** - * perform resampling on the given particle-vector - * @param particles the vector of all particles to resample - */ + /** + * perform resampling on the given particle-vector + * @param particles the vector of all particles to resample + */ virtual void resample(std::vector>& particles) = 0; /** diff --git a/smc/filtering/resampling/ParticleFilterResamplingPercent.h b/smc/filtering/resampling/ParticleFilterResamplingPercent.h index 42ec764..c992d5a 100644 --- a/smc/filtering/resampling/ParticleFilterResamplingPercent.h +++ b/smc/filtering/resampling/ParticleFilterResamplingPercent.h @@ -42,29 +42,25 @@ namespace SMC { // to-be-removed region - const int start = particles.size() * (1-percent); - const int end = particles.size(); + const int start = particles.size() * (1-percent); + const int end = particles.size(); std::uniform_int_distribution dist(0, start-1); // remove by re-drawing for (uint32_t i = start; i < end; ++i) { const int rnd = dist(gen); particles[i] = particles[rnd]; - particles[i].weight /= 2; - particles[rnd].weight /= 2; + //particles[i].weight /= 2; + //particles[rnd].weight /= 2; } // calculate weight-sum double weightSum = 0; - for (const auto& p : particles) { + double equalweight = 1.0 / (double) cnt; + for (auto& p : particles) { weightSum += p.weight; + p.weight = equalweight; } - - - int i = 0; - - - } private: diff --git a/smc/filtering/resampling/ParticleFilterResamplingSimpleImpoverishment.h b/smc/filtering/resampling/ParticleFilterResamplingSimpleImpoverishment.h index d0ad049..5144135 100644 --- a/smc/filtering/resampling/ParticleFilterResamplingSimpleImpoverishment.h +++ b/smc/filtering/resampling/ParticleFilterResamplingSimpleImpoverishment.h @@ -77,8 +77,8 @@ namespace SMC { // slight chance to get a truely random particle in range X m if (distNewOne(gen) < 0.001) { const double radius = 50.0; - const NM::NavMeshSub reachable(particlesCopy[i].state.pos, radius); - particles[i].state.pos = reachable.getRandom().drawWithin(particlesCopy[i].state.pos.pos, radius); + const NM::NavMeshSub reachable(particlesCopy[i].state.loc, radius); + particles[i].state.loc = reachable.getRandom().drawWithin(particlesCopy[i].state.loc.pos, radius); particles[i].weight = equalWeight; continue; } diff --git a/tests/math/dsp/TestFIRComplex.cpp b/tests/math/dsp/TestFIRComplex.cpp index 8b667e4..ed91ff4 100644 --- a/tests/math/dsp/TestFIRComplex.cpp +++ b/tests/math/dsp/TestFIRComplex.cpp @@ -2,7 +2,7 @@ #include #include "../../Tests.h" -#include "../../../math/dsp/FIRComplex.h" +#include "../../../math/dsp/fir/Complex.h" #include