Commit 4c4a02b8 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Fixed some problems with emitter/sensor update structure in combined model<

parent 521c15e3
......@@ -81,7 +81,7 @@ namespace ITAPropagationPathSim
inline const std::vector<int>& ReflectionIndices() const { return m_viReflectionIndices; };
inline int NumPoints() const { return size(); };
inline int NumPoints() const { return int( size() ); };
inline const VistaVector3D& SourcePoint() const { return front().position; };
inline const VistaVector3D& InitialDirection() const { return front().wavefrontNormal; };
......@@ -89,7 +89,7 @@ namespace ITAPropagationPathSim
inline const VistaVector3D& LastWavefrontNormal() const { return back().wavefrontNormal; };
inline const double& LastTimeStamp() const { return back().timeStamp; };
inline int ReflectionOrder() const { return m_viReflectionIndices.size(); };
inline int ReflectionOrder() const { return int( m_viReflectionIndices.size() ); };
//! Returns the reflection order of the ray element with given index
//int ReflectionOrder(const int idx) const;
......
......@@ -18,12 +18,12 @@ namespace ITAPropagationPathSim
namespace Diffraction
{
ITA_PROPAGATION_PATH_SIM_API bool ConstructAperturePoints( shared_ptr< const CEmitter > pEmitter, shared_ptr< const CSensor > pSensor, const int iNumberIterations, const vector< CPropagationShapeShared > pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut, ITABase::IProgressHandler* pProgressHandler = nullptr );
ITA_PROPAGATION_PATH_SIM_API bool ConstructAperturePoints( shared_ptr< const CPropagationAnchor > pEmitter, shared_ptr< const CPropagationAnchor > pSensor, const int iNumberIterations, const vector< CPropagationShapeShared > pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut, ITABase::IProgressHandler* pProgressHandler = nullptr );
//!< Exclude propagation paths with an accumulated diffraction angle that is bigger than the angle threshold.
ITA_PROPAGATION_PATH_SIM_API bool AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CEmitter > pEmitter, const vector< CPropagationShapeShared > pPropagationTreeIn, vector< CPropagationShapeShared >& pPropagationTreeOut );
ITA_PROPAGATION_PATH_SIM_API bool AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CPropagationAnchor > pEmitter, const vector< CPropagationShapeShared > pPropagationTreeIn, vector< CPropagationShapeShared >& pPropagationTreeOut );
ITA_PROPAGATION_PATH_SIM_API bool AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CEmitter > pEmitter, shared_ptr<const CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut );
ITA_PROPAGATION_PATH_SIM_API bool AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CPropagationAnchor > pEmitter, shared_ptr< const CPropagationAnchor > pSensor, const vector< CPropagationShapeShared > pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut );
}
}
......
......@@ -18,6 +18,13 @@ namespace ITAPropagationPathSim
{
using namespace ITAGeo;
//! Propagation path simulation engine combining reflections and diffractions
/**
* Propagation simulation based on geometrical paths is performed from
* source to receiver (can also be inverted).
*
*
*/
class ITA_PROPAGATION_PATH_SIM_API CPathEngine
{
public:
......@@ -32,7 +39,7 @@ namespace ITAPropagationPathSim
bool bFilterIntersectedPaths;
int iNumberIterationApexCalculation;
float fIntersectionTestResolution;
bool bReciprocalPropagationSimulation;
//bool bReciprocalPropagationSimulation;
inline CSimulationConfig()
{
......@@ -49,7 +56,7 @@ namespace ITAPropagationPathSim
bFilterIntersectedPaths = false;
iNumberIterationApexCalculation = 5;
fIntersectionTestResolution = 0.001f;
bReciprocalPropagationSimulation = true;
//bReciprocalPropagationSimulation = true; // more efficient for moving sources
};
};
......@@ -89,11 +96,14 @@ namespace ITAPropagationPathSim
void InitializePathEnvironment( shared_ptr< const Halfedge::CMeshModelList > pMeshModelList );
//! Set the source and target entities for the path finder
void SetEntities( shared_ptr< CEmitter > pEmitter, shared_ptr< CSensor > pSensor );
//! Set the source and target entities for the path finder and perform pre-processing
void SetEntities( shared_ptr< CPropagationAnchor > pOriginEntity, shared_ptr< CPropagationAnchor > pTargetEntity );
void UpdateEmitter( shared_ptr< CEmitter > pEmitter );
void UpdateSensor( shared_ptr< CSensor > pSensor );
//! Updates the emitter state (costly, if reciprocal mode is used)
void UpdateOriginEntity( shared_ptr< CPropagationAnchor > pOriginEntity );
// Updates the sensor state (costly, if normal (non-reciprocal) mode is used)
void UpdateTargetEntity( shared_ptr< CPropagationAnchor > pTargetEntity );
//! Constructs the propagation paths (requires entitites)
void ConstructPropagationPaths( CPropagationPathList& oPaths );
......@@ -120,8 +130,8 @@ namespace ITAPropagationPathSim
vector<CPropagationShapeShared> m_vpPropagationTree; //!< Vector of all propagation shapes (as well as its children) visible to the emitter
vector<CPropagationShapeShared> m_vpPropagationCandidates; //!< Vector of all propagation shape visible to the emitter with each one pointing to up to one child with the last one visible to the sensor
shared_ptr< CEmitter > m_pEmitter; //!< Const pointer to emitter
shared_ptr< CSensor > m_pSensor; //!< Const pointer to sensor
shared_ptr< CPropagationAnchor > m_pOriginEntity; //!< Pointer to (geometrical) origin entity (can acoustically also be a sensor, if reciprocally used)
shared_ptr< CPropagationAnchor > m_pTargetEntity; //!< Pointer to (geometrical) target entity (can acoustically also be an emitter, if reciprocally used)
float GetMaxPropagationRange() const;
bool GetMaxPropagationRangeValid() const;
......@@ -137,7 +147,7 @@ namespace ITAPropagationPathSim
void ConstructPropagationShapes();
// Create the propagation tree
void CreatePropagationTree();
void CreatePropagationTree( shared_ptr< CPropagationAnchor > pTrunk );
void RecursiveAddChildrenToTree( const CPropagationShapeShared & pPropagationShapeChildIn, CPropagationShapeShared& vpShapeChildCopyOut, int iReflectionOrder, int iDiffractionOrder, int iCombinedOrder, float fAccumulatedPenalty, float fFirstDistance, float fSecondDistance, float fLevelDropAtFirstEdge );
// Create the propagation list
......
......@@ -61,7 +61,7 @@ namespace ITAPropagationPathSim
} iShapeType; //! Type of Shape
//!< Shows whether shape is illuminable by sensor or not
shared_ptr<Tristate> pIsIlluminableBySensor;
shared_ptr<Tristate> pIsIlluminableByTargetEntity;
//!< Point of interaction
unique_ptr<VistaVector3D> v3InteractionPoint;
......
......@@ -26,7 +26,7 @@ namespace ITAPropagationPathSim
* @todo
*
*/
class ITA_GEO_API CShapesTree
class ITA_PROPAGATION_PATH_SIM_API CShapesTree
{
public:
//---Constructor and Destructor---------------------------------------------
......
......@@ -17,9 +17,9 @@ namespace ITAPropagationPathSim
{
using namespace std;
namespace Reflection
namespace Reflection
{
ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection(shared_ptr<const ITAGeo::CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& pPropagationListsOut);
ITA_PROPAGATION_PATH_SIM_API bool ConstructPointsOfReflection( shared_ptr< const ITAGeo::CPropagationAnchor > pSensor, const vector< CPropagationShapeShared > pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut );
}
}
}
......
......@@ -83,7 +83,7 @@ bool RecursiveAngleCulling( const ITAPropagationPathSim::CombinedModel::CPropaga
return true;
}
bool ITAPropagationPathSim::CombinedModel::Diffraction::ConstructAperturePoints( shared_ptr< const CEmitter > pEmitter, shared_ptr< const CSensor > pSensor, const int iNumberIterations, const vector< CPropagationShapeShared > vpPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut, ITABase::IProgressHandler* pProgressHandler /* = nullptr */ )
bool ITAPropagationPathSim::CombinedModel::Diffraction::ConstructAperturePoints( shared_ptr< const CPropagationAnchor > pEmitter, shared_ptr< const CPropagationAnchor > pSensor, const int iNumberIterations, const vector< CPropagationShapeShared > vpPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut, ITABase::IProgressHandler* pProgressHandler /* = nullptr */ )
{
pPropagationListsOut.clear();
......@@ -415,7 +415,7 @@ bool ITAPropagationPathSim::CombinedModel::Diffraction::ConstructAperturePoints(
return true;
}
bool ITAPropagationPathSim::CombinedModel::Diffraction::AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr<const CEmitter> pEmitter, const vector<CPropagationShapeShared> pPropagationTreeIn, vector<CPropagationShapeShared>& pPropagationTreeOut )
bool ITAPropagationPathSim::CombinedModel::Diffraction::AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CPropagationAnchor > pEmitter, const vector< CPropagationShapeShared > pPropagationTreeIn, vector< CPropagationShapeShared >& pPropagationTreeOut )
{
pPropagationTreeOut.clear();
......@@ -453,7 +453,7 @@ bool ITAPropagationPathSim::CombinedModel::Diffraction::AccumulatedAngleCulling(
return true;
}
bool ITAPropagationPathSim::CombinedModel::Diffraction::AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr<const CEmitter> pEmitter, shared_ptr<const CSensor> pSensor, const vector<CPropagationShapeShared> pPropagationListsIn, vector<CPropagationShapeShared>& pPropagationListsOut )
bool ITAPropagationPathSim::CombinedModel::Diffraction::AccumulatedAngleCulling( const float fAngleThreshold, shared_ptr< const CPropagationAnchor > pEmitter, shared_ptr< const CPropagationAnchor > pSensor, const vector< CPropagationShapeShared > pPropagationListsIn, vector< CPropagationShapeShared >& pPropagationListsOut )
{
pPropagationListsOut.clear();
......
......@@ -80,76 +80,69 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::InitializePathEnvironmen
CreateVisibilityMap();
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::SetEntities( shared_ptr< ITAGeo::CEmitter > pEmitter, shared_ptr< ITAGeo::CSensor > pSensor )
void ITAPropagationPathSim::CombinedModel::CPathEngine::SetEntities( shared_ptr< ITAGeo::CPropagationAnchor > pOriginEntity, shared_ptr< ITAGeo::CPropagationAnchor > pTargetEntity )
{
if( !pOriginEntity )
ITA_EXCEPT1( MODAL_EXCEPTION, "Origin entity empty" );
if( !pSensor )
ITA_EXCEPT1( MODAL_EXCEPTION, "Sensor empty" );
if( !pTargetEntity )
ITA_EXCEPT1( MODAL_EXCEPTION, "Target entity empty" );
if( !pEmitter )
ITA_EXCEPT1( MODAL_EXCEPTION, "Sensor empty" );
// Create propagation tree
if( m_pProgressHandler )
m_pProgressHandler->SetSection( "Applying emitter algorithms" );
m_pProgressHandler->SetSection( "Configuring origin and target entities" );
m_pEmitter = pEmitter;
m_pSensor = pSensor;
UpdateTargetEntity( pTargetEntity );
// Create propagation tree
CreatePropagationTree();
UpdateOriginEntity( pOriginEntity );
if( !m_oConfig.bReciprocalPropagationSimulation )
{
PushStatus( "Constructing specluar images of emitter", 0.0f );
ImageConstruction::ConstructImages( m_pEmitter->v3InteractionPoint, m_vpPropagationTree );
if( m_pProgressHandler )
m_pProgressHandler->SetSection( "Creating propagation list" );
//Construct image edges
PushStatus( "Constructing edge images of emitter", 0.0f );
ImageConstruction::ConstructImageEdges( m_vpPropagationTree );
}
else
{
PushStatus( "Constructing specluar images of sensor", 0.0f );
ImageConstruction::ConstructImages( m_pSensor->v3InteractionPoint, m_vpPropagationTree );
CreatePropagationLists();
}
//Construct image edges
PushStatus( "Constructing edge images of sensor", 0.0f );
ImageConstruction::ConstructImageEdges( m_vpPropagationTree );
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::UpdateOriginEntity( shared_ptr< CPropagationAnchor > pOriginEntity )
{
m_pOriginEntity = pOriginEntity;
PushStatus( "Creating propagation tree fom origin entity", 0.0f );
CreatePropagationTree( pOriginEntity );
PushStatus( "Constructing specular images of origin entity", 0.0f );
ImageConstruction::ConstructImages( m_pOriginEntity->v3InteractionPoint, m_vpPropagationTree );
//Construct image edges
PushStatus( "Constructing edge images of origin entity", 0.0f );
ImageConstruction::ConstructImageEdges( m_vpPropagationTree );
if( m_pProgressHandler )
m_pProgressHandler->SetSection( "Applying sensor algorithms" );
CreatePropagationLists();
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::UpdateEmitter( shared_ptr< CEmitter > pEmitter )
void ITAPropagationPathSim::CombinedModel::CPathEngine::UpdateTargetEntity( shared_ptr< CPropagationAnchor > pTargetEntity )
{
if( m_oConfig.bReciprocalPropagationSimulation )
{
m_pEmitter = pEmitter;
}
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::UpdateSensor( shared_ptr< CSensor > pSensor )
{
ITA_EXCEPT_NOT_IMPLEMENTED;
m_pTargetEntity = pTargetEntity;
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplyEmitter( shared_ptr<ITAGeo::CEmitter> pEmitter )
{
ITA_EXCEPT_NOT_IMPLEMENTED; // not sure if this should be used .... better use update methods
if( m_pProgressHandler )
m_pProgressHandler->SetSection( "Applying emitter algorithms" );
// Set emitter
m_pEmitter = pEmitter;
m_pOriginEntity = pEmitter;
// Create propagation tree
CreatePropagationTree();
CreatePropagationTree( pEmitter );
PushStatus( "Constructing specluar images of emitter", 0.0f );
ImageConstruction::ConstructImages( m_pEmitter->v3InteractionPoint, m_vpPropagationTree );
ImageConstruction::ConstructImages( pEmitter->v3InteractionPoint, m_vpPropagationTree );
//Construct image edges
PushStatus( "Constructing edge images of emitter", 0.0f );
......@@ -158,15 +151,17 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplyEmitter( shared_ptr
/* Following not working accurately
// Calculate accumulated angle and angle culling for tree (without knowing the exactly position)
if( m_oConfig.bAccumulatedAngleThreshold > 0 )
Diffraction::AccumulatedAngleCulling(m_oConfig.bAccumulatedAngleThreshold, m_pEmitter,m_vpPropagationTree, m_vpPropagationTree);
Diffraction::AccumulatedAngleCulling(m_oConfig.bAccumulatedAngleThreshold, m_pEmitter,m_vpPropagationTree, m_vpPropagationTree);
*/
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplySensor( shared_ptr<ITAGeo::CSensor> pSensor )
{
m_pSensor = pSensor;
ITA_EXCEPT_NOT_IMPLEMENTED; // not sure if this should be used .... better use update methods
m_pTargetEntity = pSensor;
if( !m_pSensor )
if( !m_pTargetEntity )
ITA_EXCEPT1( MODAL_EXCEPTION, "Sensor empty" );
if( m_pProgressHandler )
......@@ -176,9 +171,9 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ApplySensor( shared_ptr<
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree()
void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree( shared_ptr< CPropagationAnchor > pTrunk )
{
if( !m_pEmitter )
if( !pTrunk )
ITA_EXCEPT1( MODAL_EXCEPTION, "Can't create propagation tree without an emitter" );
// Set initial values for number of diffractions/reflections
......@@ -217,7 +212,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree()
pFaceCopy->CopyFrom( *static_pointer_cast< CPropagationFace >( pPropagationShape ) );
// Set minimum distance of face to emitter
pFaceCopy->SetMinimumDistance( m_pEmitter->v3InteractionPoint );
pFaceCopy->SetMinimumDistance( pTrunk->v3InteractionPoint );
//Boolean for illuminable faces
bool bCanIlluminated = true;
......@@ -233,7 +228,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree()
}
if( bCanIlluminated )
bCanIlluminated = CanPointIlluminateFace( m_pEmitter->v3InteractionPoint, *pFaceCopy->sMeshModelName, pFaceCopy->hFace );
bCanIlluminated = CanPointIlluminateFace( pTrunk->v3InteractionPoint, *pFaceCopy->sMeshModelName, pFaceCopy->hFace );
if( bCanIlluminated )
{
......@@ -271,7 +266,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree()
pEdgeCopy->CopyFrom( *static_pointer_cast< CPropagationEdge >( pPropagationShape ) );
//Set minimum distance of edge to emitter
pEdgeCopy->SetMinimumDistance( m_pEmitter->v3InteractionPoint );
pEdgeCopy->SetMinimumDistance( pTrunk->v3InteractionPoint );
//Boolean for illuminable edges
......@@ -287,7 +282,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreatePropagationTree()
bCanIlluminated = false;
}
bCanIlluminated &= CanPointIlluminateEdge( m_pEmitter->v3InteractionPoint, pEdgeCopy, m_oConfig.bFilterEmitterToEdgeIntersectedPaths );
bCanIlluminated &= CanPointIlluminateEdge( pTrunk->v3InteractionPoint, pEdgeCopy, m_oConfig.bFilterEmitterToEdgeIntersectedPaths );
if( bCanIlluminated )
{
......@@ -343,7 +338,6 @@ size_t ITAPropagationPathSim::CombinedModel::CPathEngine::GetNumberPropagationPa
return iNumber;
}
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPaths( ITAGeo::CPropagationPathList& oPaths )
......@@ -352,7 +346,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPath
m_pProgressHandler->SetSection( "Constructing propagation paths" );
PushStatus( "Constructing aperture points", 0.0f );
Diffraction::ConstructAperturePoints( m_pEmitter, m_pSensor, ( int ) m_oConfig.iNumberIterationApexCalculation, m_vpPropagationCandidates, m_vpPropagationCandidates, m_pProgressHandler );
Diffraction::ConstructAperturePoints( m_pOriginEntity, m_pTargetEntity, ( int ) m_oConfig.iNumberIterationApexCalculation, m_vpPropagationCandidates, m_vpPropagationCandidates, m_pProgressHandler );
// Thereafter, with the constructed aperture points, construct the image apertures as secondary image sources
// for the faces after each edge
......@@ -361,7 +355,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPath
// Construct the intersection points of the reflections
PushStatus( "Constructing intersection points of reflections", 0.0f );
Reflection::ConstructPointsOfReflection( m_pSensor, m_vpPropagationCandidates, m_vpPropagationCandidates );
Reflection::ConstructPointsOfReflection( m_pTargetEntity, m_vpPropagationCandidates, m_vpPropagationCandidates );
if( m_oAbort.fDynamicRange > 0.0f )
{
......@@ -372,7 +366,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationPath
if( m_oAbort.fAccumulatedAngleThreshold > 0 )
{
PushStatus( "Perceptual culling: accumulated angle", 0.0f );
Diffraction::AccumulatedAngleCulling( m_oAbort.fAccumulatedAngleThreshold, m_pEmitter, m_pSensor, m_vpPropagationCandidates, m_vpPropagationCandidates );
Diffraction::AccumulatedAngleCulling( m_oAbort.fAccumulatedAngleThreshold, m_pOriginEntity, m_pTargetEntity, m_vpPropagationCandidates, m_vpPropagationCandidates );
}
if( m_oConfig.bFilterIntersectedPaths )
......@@ -403,7 +397,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::PerceptionalCulling( con
auto pCurrentShape = vpPropagationList;
fLength1 = ( m_pEmitter->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
fLength1 = ( m_pOriginEntity->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
fLength2 = -1.f;
if( pCurrentShape->iShapeType == CPropagationShape::FACE )
......@@ -454,11 +448,11 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::PerceptionalCulling( con
//Add length between last shape and sensor
if( fLength2 < -Vista::Epsilon )
{
fLength1 += ( m_pSensor->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
fLength1 += ( m_pTargetEntity->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
}
else
{
fLength2 += ( m_pSensor->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
fLength2 += ( m_pTargetEntity->v3InteractionPoint - *pCurrentShape->v3InteractionPoint ).GetLength();
}
......@@ -490,7 +484,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::FilterVisiblePaths( cons
continue;
//First, check for intersections between emitter and first aperture/reflection point
if( IsPathVisible( m_pEmitter->v3InteractionPoint, *vpPropagationList->v3InteractionPoint ) )
if( IsPathVisible( m_pOriginEntity->v3InteractionPoint, *vpPropagationList->v3InteractionPoint ) )
{
bIsVisible = true;
......@@ -510,7 +504,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::FilterVisiblePaths( cons
//If the path is not already invalid, also check for intersections between sensor and last point
if( bIsVisible )
if( IsPathVisible( m_pSensor->v3InteractionPoint, *pShape->v3InteractionPoint ) )
if( IsPathVisible( m_pTargetEntity->v3InteractionPoint, *pShape->v3InteractionPoint ) )
vpVisiblePathsOut.push_back( vpPropagationList );
}
}
......@@ -521,12 +515,12 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConvertShapeListsToPropa
oPathsOut.clear();
//If the intersection filter member variable is set, only allow not intersected paths
if( ( !m_oConfig.bFilterIntersectedPaths ) || IsPathVisible( m_pEmitter->v3InteractionPoint, m_pSensor->v3InteractionPoint ) )
if( ( !m_oConfig.bFilterIntersectedPaths ) || IsPathVisible( m_pOriginEntity->v3InteractionPoint, m_pTargetEntity->v3InteractionPoint ) )
{
//Add direct path
CPropagationPath oDirectPath;
oDirectPath.push_back( m_pEmitter );
oDirectPath.push_back( m_pSensor );
oDirectPath.push_back( m_pOriginEntity );
oDirectPath.push_back( m_pTargetEntity );
oPathsOut.push_back( oDirectPath );
}
......@@ -539,7 +533,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConvertShapeListsToPropa
CPropagationPath oPath;
//The path always starts with the emitter
oPath.push_back( m_pEmitter );
oPath.push_back( m_pOriginEntity );
CPropagationShapeShared pShape = pShapeStart;
while( pShape != nullptr )
......@@ -590,7 +584,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConvertShapeListsToPropa
}
//The path always ends with the sensor
oPath.push_back( m_pSensor );
oPath.push_back( m_pTargetEntity );
//Add current path to path list
oPathsOut.push_back( oPath );
......@@ -706,14 +700,16 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddChildrenToTr
}
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddShapesToPropagationLists( shared_ptr<CPropagationShape>& pPropagationShapeIn )
void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddShapesToPropagationLists( shared_ptr< CPropagationShape >& pPropagationShapeIn )
{
if( pPropagationShapeIn == nullptr )
return;
assert( m_pTargetEntity );
//In this if case, pPropagationShapeIn is eventually tested for illuminability for the sensor
//and its branches are followed up until the first branch(illuminable by the emitter)
if( *pPropagationShapeIn->pIsIlluminableBySensor != Tristate::False )
if( *pPropagationShapeIn->pIsIlluminableByTargetEntity != Tristate::False )
{
CPropagationShapeShared pShape;
......@@ -729,15 +725,15 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddShapesToProp
return;
//If the illuminability is not found out yet, check for illuminability and break switch without setting pShape if shape is not illuminable
if( *pPropagationShapeIn->pIsIlluminableBySensor == Tristate::Undefined )
if( *pPropagationShapeIn->pIsIlluminableByTargetEntity == Tristate::Undefined )
{
if( CanPointIlluminateFace( m_pSensor->v3InteractionPoint, *pFace->sMeshModelName, pFace->hFace ) )
if( CanPointIlluminateFace( m_pTargetEntity->v3InteractionPoint, *pFace->sMeshModelName, pFace->hFace ) )
{
*pPropagationShapeIn->pIsIlluminableBySensor = Tristate::True;
*pPropagationShapeIn->pIsIlluminableByTargetEntity = Tristate::True;
}
else
{
*pPropagationShapeIn->pIsIlluminableBySensor = Tristate::False;
*pPropagationShapeIn->pIsIlluminableByTargetEntity = Tristate::False;
break;
}
}
......@@ -756,15 +752,15 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddShapesToProp
return;
//If the illuminability is not found out yet, check for illuminability
if( *pPropagationShapeIn->pIsIlluminableBySensor == Tristate::Undefined )
if( *pPropagationShapeIn->pIsIlluminableByTargetEntity == Tristate::Undefined )
{
if( CanPointIlluminateEdge( m_pSensor->v3InteractionPoint, pEdge, m_oConfig.bFilterSensorToEdgeIntersectedPaths ) )
if( CanPointIlluminateEdge( m_pTargetEntity->v3InteractionPoint, pEdge, m_oConfig.bFilterSensorToEdgeIntersectedPaths ) )
{
*pPropagationShapeIn->pIsIlluminableBySensor = Tristate::True;
*pPropagationShapeIn->pIsIlluminableByTargetEntity = Tristate::True;
}
else
{
*pPropagationShapeIn->pIsIlluminableBySensor = Tristate::False;
*pPropagationShapeIn->pIsIlluminableByTargetEntity = Tristate::False;
break;
}
}
......@@ -813,11 +809,9 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::RecursiveAddShapesToProp
}
}
//Add further shapes to propagation lists
// Add further shapes to propagation lists
for( auto& pChild : pPropagationShapeIn->vpChildren )
{
RecursiveAddShapesToPropagationLists( pChild );
}
}
void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
......@@ -826,7 +820,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
m_pProgressHandler->SetItem( "Creating visibility map" );
int i = 0;
int iNumSteps = (int) std::pow( ( int ) m_vpPropagationShapes.size(), 2 );
int iNumSteps = ( int ) std::pow( ( int ) m_vpPropagationShapes.size(), 2 );
// Check inter-visibility of all items (item matrix)
for( auto pPropagationShapeFrom : m_vpPropagationShapes )
......@@ -884,8 +878,8 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
CanFaceIlluminateFace( bCanIlluminate, pPropagationFaceFrom, pPropagationFaceTo );
}
// FACE <> EDGE
else if( pPropagationShapeTo->iShapeType == CPropagationShape::EDGE )
......@@ -920,7 +914,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
}
}
// Check edge to shape visibility
else if( pPropagationShapeFrom->iShapeType == CPropagationShape::EDGE )
......@@ -932,7 +926,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
if( pPropagationShapeTo->iShapeType == CPropagationShape::FACE )
{
auto pPropagationFaceTo = static_pointer_cast< CPropagationFace >( pPropagationShapeTo );
// Set minimum distance and test by means of the maximum propagation range for spherical propagation
if( GetMaxPropagationRangeValid() )
{
......@@ -946,7 +940,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::CreateVisibilityMap()
pPropagationFaceTo = pPropagationFaceToCopy;
pPropagationShapeTo = pPropagationFaceToCopy;
}
// If the faces are the same, they are not able to create valid paths
if( pPropagationFaceTo->sMeshModelName == pPropagationEdgeFrom->sMeshModelName )
if( pPropagationFaceTo->hFace == pPropagationEdgeFrom->hMainFace
......@@ -1228,7 +1222,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationShap
pPropagationFace->iShapeType = CPropagationShape::FACE;
pPropagationFace->sMeshModelName = psMeshModelName;
pPropagationFace->pIsIlluminableBySensor = make_shared<Tristate>( Tristate::Undefined );
pPropagationFace->pIsIlluminableByTargetEntity = make_shared<Tristate>( Tristate::Undefined );
pPropagationFace->hFace = hFace;
pPropagationFace->hShape = hFace;
......@@ -1286,7 +1280,7 @@ void ITAPropagationPathSim::CombinedModel::CPathEngine::ConstructPropagationShap
pPropagationEdge->iShapeType = CPropagationShape::EDGE;
pPropagationEdge->sMeshModelName = psMeshModelName;
pPropagationEdge->pIsIlluminableBySensor = make_shared<Tristate>( Tristate::Undefined );
pPropagationEdge->pIsIlluminableByTargetEntity = make_shared<Tristate>( Tristate::Undefined );
pPropagationEdge->hEdge = hEdge;
pPropagationEdge->hHalfedge = hHalfedge;
pPropagationEdge->hShape = hHalfedge;
......
......@@ -4,7 +4,7 @@
using namespace ITAPropagationPathSim::CombinedModel;
void CPropagationShape::CopyFrom(const CPropagationShape & oPropagationShapeIn)
void CPropagationShape::CopyFrom( const CPropagationShape & oPropagationShapeIn )
{
iShapeType = oPropagationShapeIn.iShapeType;
......@@ -17,61 +17,57 @@ void CPropagationShape::CopyFrom(const CPropagationShape & oPropagationShapeIn)
v3Barycenter = oPropagationShapeIn.v3Barycenter;