Commit bf52a580 authored by Armin Erraji's avatar Armin Erraji

Removed loops that where used for testing.

parent ffe1a443
......@@ -19,7 +19,7 @@ namespace ITAPropagationPathSim
namespace Reflection
{
ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection(vector<CPropagationShapeShared>& pPropagationLists, shared_ptr<const ITAGeo::CSensor> pSensor);
ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection(shared_ptr<const ITAGeo::CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& pPropagationListsOut);
}
}
}
......
......@@ -101,59 +101,24 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplySensor(shared_ptr<I
void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPaths(ITAGeo::CPropagationPathList& oPaths)
{
ITAStopWatch sw; sw.start();
int iNullCounter = 0, iReferenceCounter = 0;
for (auto& pPropagationList : m_vpPropagationLists)
{
if (pPropagationList == nullptr)
iNullCounter++;
else
iReferenceCounter++;
}
std::cout << iReferenceCounter << " references and " << iNullCounter << " times nullptr at start. Calculation time for counting: " << timeToString(sw.stop()) <<endl;
std::cout << m_vpPropagationLists.size() << " path candidates at start. Calculation time for counting: " << timeToString(sw.stop()) <<endl;
sw.start();
//First, construct the aperture points
Diffraction::ConstructAperturePoints(m_pEmitter, m_pSensor, m_vpPropagationLists, m_vpPropagationLists);
iNullCounter = 0, iReferenceCounter = 0;
for (auto& pPropagationList : m_vpPropagationLists)
{
if (pPropagationList == nullptr)
iNullCounter++;
else
iReferenceCounter++;
}
std::cout << iReferenceCounter << " references and " << iNullCounter << " times nullptr after aperture points calculated. Calculation time: " << timeToString(sw.stop()) << endl;
std::cout << m_vpPropagationLists.size() << " path candidates after aperture points calculated. Calculation time: " << timeToString(sw.stop()) << endl;
sw.start();
//Thereafter, with the constructed aperture points, construct the image apertures as secondary image sources
//for the faces after each edge
ImageConstruction::ConstructImageApertures(m_vpPropagationLists, m_vpPropagationLists);
iNullCounter = 0, iReferenceCounter = 0;
for (auto& pPropagationList : m_vpPropagationLists)
{
if (pPropagationList == nullptr)
iNullCounter++;
else
iReferenceCounter++;
}
std::cout << iReferenceCounter << " references and " << iNullCounter << " times nullptr after image aperture calculated. Calculation time: " << timeToString(sw.stop()) << endl;
std::cout << m_vpPropagationLists.size() << " path candidates after image aperture calculated. Calculation time: " << timeToString(sw.stop()) << endl;
sw.start();
//Construct the intersection points of the reflections
Reflection::ConstructPointsOfReflection(m_vpPropagationLists, m_pSensor);
iNullCounter = 0, iReferenceCounter = 0;
for (auto& pPropagationList : m_vpPropagationLists)
{
if (pPropagationList == nullptr)
iNullCounter++;
else
iReferenceCounter++;
}
std::cout << iReferenceCounter << " references and " << iNullCounter << " times nullptr after points of reflection calculated. Calculation time: " << timeToString(sw.stop()) << endl;
Reflection::ConstructPointsOfReflection(m_pSensor, m_vpPropagationLists, m_vpPropagationLists);
std::cout << m_vpPropagationLists.size() << " path candidates after points of reflection calculated. Calculation time: " << timeToString(sw.stop()) << endl;
sw.start();
......@@ -161,7 +126,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPath
{
FilterVisiblePaths(m_vpPropagationLists, m_vpPropagationLists);
cout << "Calculation time filtering visible paths: " << timeToString(sw.stop()) << endl;
cout << "Calculation time for filter of non-intersected and therefore visible paths: " << timeToString(sw.stop()) << endl;
}
......@@ -218,11 +183,21 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::FilterVisiblePaths(const
void ITAPropagationPathSim::CombinedModel::CPathEngine::ConvertShapeListsToPropagationPaths(ITAGeo::CPropagationPathList& oPathsOut)
{
//Add direct path
CPropagationPath oDirectPath;
oDirectPath.push_back(m_pEmitter);
oDirectPath.push_back(m_pSensor);
oPathsOut.push_back(oDirectPath);
oPathsOut.clear();
//If the intersection filter member variable is set, only allow not intersected paths
if ((!*m_pFilterIntersectedPaths) || IsPathVisible(m_pEmitter->v3InteractionPoint, 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)
{
......
#include <ITAPropagationPathSim\CombinedModel\ReflectionLocator.h>
bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflection(vector<CPropagationShapeShared>& pPropagationLists, shared_ptr<const ITAGeo::CSensor> pSensor)
bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflection(shared_ptr<const ITAGeo::CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& 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<VistaVector3D>(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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment