From bf52a580f3036444997dd549a7c28e290ed14cc7 Mon Sep 17 00:00:00 2001 From: Armin Erraji Date: Sun, 3 Feb 2019 14:49:12 +0100 Subject: [PATCH] Removed loops that where used for testing. --- .../CombinedModel/ReflectionLocator.h | 2 +- .../CombinedModel/PropagationEngine.cpp | 69 ++++++------------- .../CombinedModel/ReflectionLocator.cpp | 22 ++++-- 3 files changed, 38 insertions(+), 55 deletions(-) diff --git a/include/ITAPropagationPathSim/CombinedModel/ReflectionLocator.h b/include/ITAPropagationPathSim/CombinedModel/ReflectionLocator.h index 2832803..2e66a25 100644 --- a/include/ITAPropagationPathSim/CombinedModel/ReflectionLocator.h +++ b/include/ITAPropagationPathSim/CombinedModel/ReflectionLocator.h @@ -19,7 +19,7 @@ namespace ITAPropagationPathSim namespace Reflection { - ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection(vector& pPropagationLists, shared_ptr pSensor); + ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection(shared_ptr pSensor, const vector pPropagationListsIn, vector& pPropagationListsOut); } } } diff --git a/src/ITAPropagationPathSim/CombinedModel/PropagationEngine.cpp b/src/ITAPropagationPathSim/CombinedModel/PropagationEngine.cpp index 715c283..b2363fe 100644 --- a/src/ITAPropagationPathSim/CombinedModel/PropagationEngine.cpp +++ b/src/ITAPropagationPathSim/CombinedModel/PropagationEngine.cpp @@ -101,59 +101,24 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplySensor(shared_ptrv3InteractionPoint, m_pSensor->v3InteractionPoint)) + { + //Add direct path + CPropagationPath oDirectPath; + oDirectPath.push_back(m_pEmitter); + oDirectPath.push_back(m_pSensor); + oPathsOut.push_back(oDirectPath); + } + for (auto& pShapeStart : m_vpPropagationLists) { diff --git a/src/ITAPropagationPathSim/CombinedModel/ReflectionLocator.cpp b/src/ITAPropagationPathSim/CombinedModel/ReflectionLocator.cpp index e3d849a..b765cca 100644 --- a/src/ITAPropagationPathSim/CombinedModel/ReflectionLocator.cpp +++ b/src/ITAPropagationPathSim/CombinedModel/ReflectionLocator.cpp @@ -1,13 +1,18 @@ #include -bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflection(vector& pPropagationLists, shared_ptr pSensor) +bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflection(shared_ptr pSensor, const vector pPropagationListsIn, vector& pPropagationListsOut) { - for (auto& pStartShape : pPropagationLists) + pPropagationListsOut.clear(); + + + for (auto& pStartShape : pPropagationListsIn) { //Empty lists are ignored if (pStartShape == nullptr) continue; + bool bValidReflectionPoints = true; + //First, go to the last shape CPropagationShapeShared pShape = pStartShape; while (pShape->pChild != nullptr) @@ -29,7 +34,7 @@ bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflecti //If the face doesn't contain a valid face, the whole path will be invalid if (*pFace->pHasValidImageSource == false) { - pStartShape = nullptr; + bValidReflectionPoints = false; break; } @@ -44,16 +49,16 @@ bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflecti pFace->v3InteractionPoint = make_unique(v3LastInteraction); } - else //invalid path because the current interaction point does not lie on the face + else //Invalid path because the current interaction point does not lie on the face { - pStartShape = nullptr; + bValidReflectionPoints = false; break; } } - else //invalid path because the last intersection is not in front of face + else //Invalid path because the last intersection is not in front of face { - pStartShape = nullptr; + bValidReflectionPoints = false; break; } @@ -66,6 +71,9 @@ bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflecti pShape = pShape->pParent.lock(); } + //If no invalid point occurs, add shapes to output list + if (bValidReflectionPoints) + pPropagationListsOut.push_back(pStartShape); } -- GitLab