Commit d4710ee0 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen

Merge branch 'ma_2018/erraji' of...

Merge branch 'ma_2018/erraji' of https://git.rwth-aachen.de/ita/ITAPropagationPathSim into ma_2018/erraji
parents 551e238b 78b33e95
......@@ -68,3 +68,4 @@ if( ITA_GEOMETRICAL_ACOUSTICS_WITH_TESTS OR ITA_PROPAGATION_PATH_SIM_WITH_TESTS
set( ITAPropagationPathSim_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
endif( )
......@@ -18,7 +18,12 @@ namespace ITAPropagationPathSim
namespace Diffraction
{
bool ITA_PROPAGATION_PATH_SIM_API ConstructAperturePoints(shared_ptr<const CEmitter> pEmitter, shared_ptr<const CSensor> pSensor, vector<CPropagationShapeShared>& pPropagationLists);
bool ITA_PROPAGATION_PATH_SIM_API ConstructAperturePoints(shared_ptr<const CEmitter> pEmitter, shared_ptr<const CSensor> pSensor, const int iNumberIterations, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& pPropagationListsOut);
//!< Exclude propagation paths with an accumulated diffraction angle that is bigger than the angle threshold.
bool ITA_PROPAGATION_PATH_SIM_API AccumulatedAngleCulling(const float fAngleThreshold, shared_ptr<const CEmitter> pEmitter, const vector<CPropagationShapeShared> pPropagationTreeIn, vector<CPropagationShapeShared>& pPropagationTreeOut);
bool ITA_PROPAGATION_PATH_SIM_API AccumulatedAngleCulling(const float fAngleThreshold, shared_ptr<const CEmitter> pEmitter, shared_ptr<const CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& pPropagationListsOut);
}
}
......
......@@ -22,7 +22,7 @@ namespace ITAPropagationPathSim
ITA_PROPAGATION_PATH_SIM_API bool ConstructImageSources(shared_ptr<const CEmitter> pEmitter, vector<CPropagationShapeShared>& vpPropagationTree);
ITA_PROPAGATION_PATH_SIM_API bool ConstructImageReceivers(shared_ptr<const CSensor> pSensor, vector<CPropagationShapeShared>& vpPropagationLists, CShapesMap vpVisibilityMap, const int iMaxReflectionOrder);
ITA_PROPAGATION_PATH_SIM_API bool ConstructImageApertures(vector<CPropagationShapeShared>& vpPropagationLists);
ITA_PROPAGATION_PATH_SIM_API bool ConstructImageApertures(const vector<CPropagationShapeShared> vpPropagationListsIn, vector<CPropagationShapeShared>& vpPropagationListsOut);
......
......@@ -8,6 +8,8 @@
#include <ITAGeo/Halfedge/MeshModel.h>
#include <ITAGeo/Utils.h>
namespace ITAPropagationPathSim
{
namespace CombinedModel
......@@ -19,7 +21,19 @@ namespace ITAPropagationPathSim
public:
//Constructor
CPathEngine(shared_ptr<const Halfedge::CMeshModelList> pMeshModelList);
CPathEngine();
void Configure(const bool bFilterNotNeighbouredEdges = false, const bool bFilterIlluminatedRegionDiffraction = false,
const bool bFilterEdgeToEdgeIntersectedPaths = false,
const bool bFilterEmitterToEdgeIntersectedPaths = false,
const bool bFilterSensorToEdgeIntersectedPaths = false,
const bool bFilterIntersectedPaths = false,
const int iNumberIterationApexCalculation = 5,
const float fIntersectionTestResolution = 0.001f,
const float fAccumulatedAngleThreshold = -1.0f);
void InitializePathEnvironment(shared_ptr<const Halfedge::CMeshModelList> pMeshModelList);
void ApplyEmitter(shared_ptr<CEmitter> pEmitter, const int iMaxDiffractions, const int iMaxReflections, const int iMaxCombinedOrder);
......@@ -28,6 +42,7 @@ namespace ITAPropagationPathSim
void ConstructPropagationPaths(CPropagationPathList& oPaths);
private:
vector<CPropagationShapeShared> m_vpPropagationShapes; //!< Vector of all propagation shapes
......@@ -40,13 +55,27 @@ namespace ITAPropagationPathSim
unique_ptr<const int> m_pMaxReflectionOrder; //!< Const pointer to maximum reflection order
unique_ptr<const int> m_pMaxDiffractionOrder; //!< Const pointer to maximum diffraction order
unique_ptr<const int> m_pMaxCombinedOrder; //!< Const pointer to maximum order of combined diffractions and reflections
//Filter member variables
unique_ptr<const bool> m_pFilterNotNeighbouredEdges; //!< Filter not neighboured edges for faster filter calculation
unique_ptr<const bool> m_pFilterIlluminatedRegionDiffraction; //!< Boolean pointer whether to ignore diffractions that can only diffract in illuminated regions(and have therefore a low impact to the whole IR)
unique_ptr<const bool> m_pFilterEdgeToEdgeIntersectedPaths; //!< Boolean pointer for filtering paths, where always an intersection between two edges occurs
unique_ptr<const bool> m_pFilterEmitterToEdgeIntersectedPaths; //!< Boolean pointer for filtering paths, where always an intersection between the emitter and an edge occurs
unique_ptr<const bool> m_pFilterSensorToEdgeIntersectedPaths; //!< Boolean pointer for filtering paths, where always an intersection between the sensor and an edge occurs
unique_ptr<const bool> m_pFilterIntersectedPaths; //!< Boolean pointer for for filtering paths if intersection occurs
unique_ptr<const float> m_pIntersectionTestResolution; //!< Resolution for intersection test
unique_ptr <const float> m_pAccumulatedAngleThreshold; //!< Threshold for the accumulated diffraction angle
unique_ptr <const size_t> m_pNumberIterationApexCalc; //!< Number of iterations for the calculation of the aperture points
void CreateVisibilityMap();
bool CanPointIlluminateFace(const VistaVector3D & v3Point, const string & sMeshModelName, CITAMesh::FaceHandle hFace);
bool CanPointIlluminateEdge(const VistaVector3D & v3Point, CPropagationEdgeShared & pPropagationEdge, const bool& bTestIntersection = false);
bool IsPathVisible(const VistaVector3D & v3StartPoint, const VistaVector3D & v3EndPoint);
void CanEdgeIlluminateFace(bool & bCanEdgeIlluminateFaceOut, ITAPropagationPathSim::CombinedModel::CPropagationFaceShared & pPropagationFace, ITAPropagationPathSim::CombinedModel::CPropagationEdgeShared & pPropagationEdge);
void CanFaceIlluminateEdge(bool & bCanFaceIlluminateEdgeOut, CPropagationFaceShared & pPropagationFace, CPropagationEdgeShared & pPropagationEdge);
void CanFaceIlluminateFace(bool & bCanFaceIlluminateFaceOut, CPropagationFaceShared & pPropagationFaceStart, CPropagationFaceShared & pPropagationFaceEnd);
void CanEdgeIlluminateEdge(bool & bCanEdgeIlluminateEdgeOut, CPropagationEdgeShared & pPropagationEdgeStart, CPropagationEdgeShared & pPropagationEdgeEnd);
void CanEdgeIlluminateEdge(bool & bCanEdgeIlluminateEdgeOut, CPropagationEdgeShared & pPropagationEdgeStart, CPropagationEdgeShared & pPropagationEdgeEnd, const bool& bTestIntersection = false);
void ConstructPropagationShapes();
//Create the propagation tree
......@@ -57,6 +86,10 @@ namespace ITAPropagationPathSim
void CreatePropagationLists();
void RecursiveAddShapesToPropagationLists(shared_ptr<CPropagationShape>& pPropagationShapeIn);
//Filter not visible, intersected, paths
void FilterVisiblePaths(const vector<CPropagationShapeShared> vpAllPathsIn, vector<CPropagationShapeShared>& vpVisiblePathsOut);
//Convert the propagation list
void ConvertShapeListsToPropagationPaths(ITAGeo::CPropagationPathList& oPathsOut);
......
......@@ -30,11 +30,11 @@ namespace ITAPropagationPathSim
typedef string MeshModelHandle;
typedef pair < MeshModelHandle, CITAMesh::FaceHandle> PropagationFaceHandle;
struct ImageReceiverMap : map<PropagationFaceHandle, shared_ptr<ImageReceiverMap>>
{
//struct ImageReceiverMap : map<PropagationFaceHandle, shared_ptr<ImageReceiverMap>>
/* {
shared_ptr<VistaVector3D> v3ImageReceiver;
shared_ptr<bool> pHasIlluminableImageReceiver;
};
};*/
enum Tristate : uint8_t
{
......@@ -66,7 +66,7 @@ namespace ITAPropagationPathSim
unique_ptr<VistaVector3D> v3InteractionPoint;
//!< Parent shape(previous shape)
CPropagationShapeShared pParent;
weak_ptr<CPropagationShape> pParent;
//!< Child(ren) shape(s)
CPropagationShapeShared pChild; //Shape used in propagation paths
......@@ -93,7 +93,9 @@ namespace ITAPropagationPathSim
vector<shared_ptr<VistaVector3D>> vv3Vertices;
shared_ptr<VistaVector3D> v3ImageSource;
shared_ptr<VistaVector3D> v3ImageReceiver;
shared_ptr<VistaVector3D> v3ImageEdgeSourceStart;
shared_ptr<VistaVector3D> v3ImageEdgeSourceEnd;
shared_ptr<bool> pHasValidImageSource;
......@@ -114,13 +116,13 @@ namespace ITAPropagationPathSim
shared_ptr<bool> pHasValidImageEdge;
shared_ptr<VistaVector3D> v3FromVertex;//!< Start vertex of corresponding halfedge
shared_ptr<VistaVector3D> v3ToVertex;//!< End vertex of corresponding halfedge
shared_ptr<VistaVector3D> v3StartVertex;//!< Start vertex of corresponding halfedge
shared_ptr<VistaVector3D> v3EndVertex;//!< End vertex of corresponding halfedge
shared_ptr<VistaVector3D> v3MainFaceNormal;//!< Face normal of main face
shared_ptr<VistaVector3D> v3OppositeFaceNormal;//!< Face normal of opposing face
shared_ptr<VistaVector3D> v3FromVertexMirrored;
shared_ptr<VistaVector3D> v3ToVertexMirrored;
shared_ptr<VistaVector3D> v3ImageEdgeReceiverStart; //!< Start vertex of corresponding mirrored halfedge
shared_ptr<VistaVector3D> v3ImageEdgeReceiverEnd;//!< End vertex of corresponding mirrored halfedge
//!< Position of interaction point relative to the ray starting at v3FromVertex and showing in direction of (v3ToVertex - v3FromVertex)
......
......@@ -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);
}
}
}
......
......@@ -24,7 +24,6 @@ void CPropagationFace::CopyFrom(const CPropagationFace & oPropagationFaceIn)
pPlane = oPropagationFaceIn.pPlane;
vv3Vertices = oPropagationFaceIn.vv3Vertices;
v3ImageSource = oPropagationFaceIn.v3ImageSource;
v3ImageReceiver = oPropagationFaceIn.v3ImageReceiver;
pHasValidImageSource = oPropagationFaceIn.pHasValidImageSource;
}
......@@ -37,11 +36,11 @@ void CPropagationEdge::CopyFrom(const CPropagationEdge & oPropagationEdgeIn)
hEdge = oPropagationEdgeIn.hEdge;
hMainFace = oPropagationEdgeIn.hMainFace;
hOppositeFace = oPropagationEdgeIn.hOppositeFace;
v3FromVertex = oPropagationEdgeIn.v3FromVertex;
v3ToVertex = oPropagationEdgeIn.v3ToVertex;
v3StartVertex = oPropagationEdgeIn.v3StartVertex;
v3EndVertex = oPropagationEdgeIn.v3EndVertex;
v3MainFaceNormal = oPropagationEdgeIn.v3MainFaceNormal;
v3OppositeFaceNormal = oPropagationEdgeIn.v3OppositeFaceNormal;
v3FromVertexMirrored = oPropagationEdgeIn.v3FromVertexMirrored;
v3ToVertexMirrored = oPropagationEdgeIn.v3ToVertexMirrored;
v3ImageEdgeReceiverStart = oPropagationEdgeIn.v3ImageEdgeReceiverStart;
v3ImageEdgeReceiverEnd = oPropagationEdgeIn.v3ImageEdgeReceiverEnd;
pHasValidImageEdge = oPropagationEdgeIn.pHasValidImageEdge;
}
#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;
}
......@@ -63,9 +68,12 @@ bool ITAPropagationPathSim::CombinedModel::Reflection::ConstructPointsOfReflecti
v3LastInteraction = *pShape->v3InteractionPoint;
}
pShape = pShape->pParent;
pShape = pShape->pParent.lock();
}
//If no invalid point occurs, add shapes to output list
if (bValidReflectionPoints)
pPropagationListsOut.push_back(pStartShape);
}
......
......@@ -80,16 +80,38 @@ int main( int iNumInArgs, char* pcInArgs[] )
cout << "Emitter: " << pEmitter->vPos << endl;
cout << "Sensor: " << pSensor->vPos << endl;
//Configuration of the engine
const bool bOnlyNeighbouredEdgeDiffraction = false;
const bool bDiffractionOnlyIntoShadowRegion = true;
const bool bFilterNotVisiblePathsBetweenEdges = false; //Intersection test between edges(expensive)
const bool bFilterNotVisiblePointToEdge = true; //Intersection test between emitter/sensor and edges
const bool bFilterNotVisiblePaths = true; //Intersection test of calculated sub paths
const float fIntersectionTestResolution = 0.001;
const int iNumIterations = 5;//!< Number of iterations for the calculation of the aperture points
const int fMaxAccumulatedDiffractionAngle = -2*ITAConstants::PI_F;
const int iMaxDiffractionOrder = 5;
const int iMaxReflectionOrder = 2;
const int iMaxCombinedOrder = 5;
ITAStopWatch sw; sw.start();
auto pPathEngine = make_shared<CombinedModel::CPathEngine>(pMeshModelList);
auto pPathEngine = make_shared<CombinedModel::CPathEngine>();
cout << "Calculation time initialization path engine: " << timeToString(sw.stop()) << endl;
sw.start();
pPathEngine->ApplyEmitter(pEmitter,ITAGeo::DIFFRACTION_ORDER_2,ORDER_2,ORDER_3);
pPathEngine->Configure(bOnlyNeighbouredEdgeDiffraction, bDiffractionOnlyIntoShadowRegion, bFilterNotVisiblePathsBetweenEdges, bFilterNotVisiblePointToEdge, bFilterNotVisiblePointToEdge,bFilterNotVisiblePaths, iNumIterations,fIntersectionTestResolution,fMaxAccumulatedDiffractionAngle);
cout << "Calculation time configuring filter: " << timeToString(sw.stop()) << endl;
sw.start();
pPathEngine->InitializePathEnvironment(pMeshModelList);
cout << "Calculation time initialization path environment: " << timeToString(sw.stop()) << endl;
sw.start();
pPathEngine->ApplyEmitter(pEmitter, iMaxDiffractionOrder, iMaxReflectionOrder, iMaxCombinedOrder);
cout << "Calculation time applying emitter: " << timeToString(sw.stop()) << endl;
sw.start();
......@@ -104,8 +126,14 @@ int main( int iNumInArgs, char* pcInArgs[] )
pPathEngine->ConstructPropagationPaths(oPathListAll);
cout << "Calculation time propagation path creation: " << timeToString(sw.stop()) << endl;
sw.start();
pMeshModelList->FilterVisiblePaths(oPathListAll, oPathListVisible);
cout << "Calculation time filtering visible paths: " << timeToString(sw.stop()) << endl;
cout << "All paths: " << to_string(oPathListAll.size()) << endl;
cout << "Visible paths: " << to_string(oPathListVisible.size()) << endl;
//Add emitter and sensor to visualization
oGeoModel.AddEmitterVisualization(*pEmitter, "Emitter A");
......@@ -123,7 +151,7 @@ int main( int iNumInArgs, char* pcInArgs[] )
oGeoModel.AddPropagationPathVisualization(oPath, sPathName);
}
oPathListVisible.Store("CombinedModelTest_" + sInFile + ".json");
//oPathListVisible.Store("CombinedModelTest_" + sInFile + ".json");
oGeoModel.Store(sSubFolder +"CombinedModelTest_"+ sInFile);
......
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