WIP revising diffraction apterture classes

parent 100dbb8d
......@@ -82,7 +82,7 @@ void benchmark_single_wedge()
oReceiver->qOrient = VistaQuaternion( 0, 1, 0, 0 );
oReceiver->vPos.SetValues( -.4f, .6f, .1f );
auto pWedge = std::make_shared< ITAGeo::CITADiffractionWedgeAperture >();
auto pWedge = std::make_shared< ITAGeo::CITADiffractionWedgeApertureBase >();
pWedge->v3MainWedgeFaceNormal = VistaVector3D( 1.0f, 1.0f, .0f ).GetNormalized();
pWedge->v3OppositeWedgeFaceNormal = VistaVector3D( -1.0f, 1.0f, .0f ).GetNormalized();
pWedge->v3VertextStart.SetValues( .0f, 1.0f, -1.0f );
......
......@@ -61,7 +61,7 @@ namespace ITAPropagationModels
* @note Throws ITAException on error
*
*/
bool ITA_PROPAGATION_MODELS_API IsApplicable( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex );
bool ITA_PROPAGATION_MODELS_API IsApplicable( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex );
//! Calculates the detour of a propagation path for the Maekawa method
/**
......@@ -78,7 +78,7 @@ namespace ITAPropagationModels
* @note Throws ITAException on error
*
*/
void ITA_PROPAGATION_MODELS_API GetDirectLengthAndDetourLength( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, double& dPropagationLengthDirect, double& dPropagationLengthDetour );
void ITA_PROPAGATION_MODELS_API GetDirectLengthAndDetourLength( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, double& dPropagationLengthDirect, double& dPropagationLengthDetour );
//! Calculates the detour-and-direct-path difference of a propagation path for the Maekawa method
/**
......
......@@ -49,7 +49,7 @@ namespace ITAPropagationModels
*
* @sa GetMinimumWavefrontDelayTime, GetMaximumWavefrontDelayTime
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
}
}
......
......@@ -63,7 +63,7 @@ namespace ITAPropagationModels
* @param[out] cfCoeff Complex-valued diffraction coefficient ( D( n, k,\rho, r, \phi_i, \alpha_i, \alpha_d ) )
* @param[in] iMethod Approximation algorithm
*/
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN );
ITA_PROPAGATION_MODELS_API bool CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN );
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
......@@ -78,7 +78,7 @@ namespace ITAPropagationModels
* @param[in] iMethod Approximation algorithm
* @param[in] fSpeedOfSound Sound speed
*/
ITA_PROPAGATION_MODELS_API void CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
ITA_PROPAGATION_MODELS_API void CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod = UTD_APPROX_KAWAI_KOUYOUMJIAN, const float fSpeedOfSound = ITAConstants::SPEED_OF_SOUND_F );
}
}
......
......@@ -100,10 +100,11 @@ void CFilterEngine::ApplyDiffractionModel(ITAGeo::CPropagationPathList & oPathLi
auto& pCurrentAnchor = oPath[i];
auto& pNextAnchor = oPath[i + 1];
//If the anchor is a reflection and the acoustic material is not set yet, set it to default values
if ((pCurrentAnchor->iAnchorType == ITAGeo::CPropagationAnchor::DIFFRACTION_APEX) && (pCurrentAnchor->pAcousticMaterial == NULL))
//If the anchor is a diffraction and the acoustic material is not set yet, set it to default values
if ((pCurrentAnchor->iAnchorType == ITAGeo::CPropagationAnchor::DIFFRACTION_OUTER_APEX ||
pCurrentAnchor->iAnchorType == ITAGeo::CPropagationAnchor::DIFFRACTION_INNER_APEX ) && ( pCurrentAnchor->pAcousticMaterial == NULL ) )
{
auto pApex = std::dynamic_pointer_cast<ITAGeo::CITADiffractionWedgeAperture>(pCurrentAnchor);
auto pApex = std::dynamic_pointer_cast<ITAGeo::CITADiffractionWedgeApertureBase>(pCurrentAnchor);
if (iDiffractionModel == ITAGeo::IAcousticMaterial::THIRD_OCTAVE)
{
......
......@@ -7,12 +7,12 @@
using namespace ITAGeo;
using namespace ITAPropagationModels;
bool Maekawa::IsApplicable( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex )
bool Maekawa::IsApplicable( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex )
{
return pApex->IsOccluding( v3SourcePos, v3TargetPos );
}
void Maekawa::GetDirectLengthAndDetourLength( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, double& dPropagationLengthDirect, double& dPropagationLengthDetour )
void Maekawa::GetDirectLengthAndDetourLength( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, double& dPropagationLengthDirect, double& dPropagationLengthDetour )
{
dPropagationLengthDetour = ( pApex->v3InteractionPoint - v3SourcePos ).GetLength() + ( v3TargetPos - pApex->v3InteractionPoint ).GetLength();
dPropagationLengthDirect = ( v3TargetPos - v3SourcePos ).GetLength();
......
......@@ -13,7 +13,7 @@ using namespace ITAPropagationModels;
float SvenssonHelperHeavisideFunction( const float fX );
//! Helper function to evaluate Svensson's integral solution at given time
float SvenssonHelperIntegralSolution( const float t, const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fSpeedOfSound );
float SvenssonHelperIntegralSolution( const float t, const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fSpeedOfSound );
//! Midpoint approximation to evalute Svensson's integral
float SvenssonHelperIntegralMidpointApproximation( const float t );
......@@ -24,7 +24,7 @@ float SvenssonHelperBeta( const float nu, const float theta_s, const float theta
//! Plus-minus variant for beta values in geometrical functions
float SvenssonHelperBetaEval( const float nu, const float alpha, const float gamma, const float fPMVariant );
bool Svensson::CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound /* = ITAConstants::SPEED_OF_SOUND_F */ )
bool Svensson::CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CFiniteImpulseResponse& oEffectiveDiffractionIR, const float fSpeedOfSound /* = ITAConstants::SPEED_OF_SOUND_F */ )
{
if( fSpeedOfSound <= 0.0f )
ITA_EXCEPT_INVALID_PARAMETER( "Speed of sound must be greate zero" );
......@@ -47,7 +47,7 @@ bool Svensson::CalculateDiffractionIR( const VistaVector3D& v3SourcePos, const V
return true;
}
float SvenssonHelperIntegralSolution( const float t, const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fSpeedOfSound )
float SvenssonHelperIntegralSolution( const float t, const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fSpeedOfSound )
{
if( fSpeedOfSound <= 0.0f )
ITA_EXCEPT_INVALID_PARAMETER( "Speed of sound can't be smaller or equal zero for diffraction model" );
......
......@@ -30,7 +30,7 @@ float UTDHelperFunction_a_plus( const float fBeta, const float n );
float UTDHelperFunction_a_minus( const float fBeta, const float n );
void UTD::CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */, const float fSpeedOfSound /* = ITAConstants::SPEED_OF_SOUND_F */ )
void UTD::CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, ITABase::CHDFTSpectrum& oTF, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */, const float fSpeedOfSound /* = ITAConstants::SPEED_OF_SOUND_F */ )
{
std::complex< float > cfCoeff;
oTF.SetCoeffRI( 0, 1.0f, 0.0f ); // DC
......@@ -44,7 +44,7 @@ void UTD::CalculateDiffractionFilter( const VistaVector3D& v3SourcePos, const Vi
}
}
bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeAperture > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */ )
bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, const VistaVector3D& v3TargetPos, std::shared_ptr< const ITAGeo::CITADiffractionWedgeApertureBase > pApex, const float fWaveNumber, std::complex< float >& cfCoeff, const int iMethod /* = UTD_APPROX_KAWAI_KOUYOUMJIAN */ )
{
if( ITAGeoUtils::IsPointInsideDiffrationWedge( pApex->v3VertextStart, pApex->v3VertextEnd, pApex->v3MainWedgeFaceNormal, pApex->v3OppositeWedgeFaceNormal, v3SourcePos ) )
return false;
......
......@@ -45,14 +45,14 @@ int main(int, char**)
auto pReflection = make_shared< CSpecularReflection >(VistaVector3D(0.0f, 2.0f, 0.0f));
auto pDiffraction = make_shared< CITADiffractionWedgeAperture >();
auto pDiffraction = make_shared< CITADiffractionWedgeApertureBase >();
pDiffraction->v3AperturePoint = VistaVector3D(0.0f, -2.0f, 0.0f);
pDiffraction->v3VertextStart = VistaVector3D(0.0f, -2.0f, 1.0f);
pDiffraction->v3VertextEnd = VistaVector3D(0.0f, -2.0f, -1.0f);
pDiffraction->v3MainWedgeFaceNormal = VistaVector3D(-1.0f, 0.0f, 0.0f);
pDiffraction->v3OppositeWedgeFaceNormal = VistaVector3D(0.0f, 1.0f, 0.0f);
auto pW = std::make_shared< CITADiffractionWedgeAperture >();
auto pW = std::make_shared< CITADiffractionWedgeApertureBase >();
pW->v3AperturePoint.SetValues(0.0f, 1.0f, 0.0f);
pW->v3MainWedgeFaceNormal.SetValues(-1.0f, 1.0f, .0f);
pW->v3MainWedgeFaceNormal.Normalize();
......
......@@ -45,7 +45,7 @@ int main( int, char** )
auto pS = std::make_shared< CEmitter >( VistaVector3D( -2.0f, 0, 0 ) );
auto pR = std::make_shared< CSensor >( VistaVector3D( 2.0f, 0, 0 ) );
auto pW = std::make_shared< CITADiffractionWedgeAperture >();
auto pW = std::make_shared< CITADiffractionWedgeApertureBase >();
pW->v3AperturePoint.SetValues( 0.0f, 1.0f, 0.0f );
pW->v3MainWedgeFaceNormal.SetValues( -1.0f, 1.0f, .0f );
pW->v3MainWedgeFaceNormal.Normalize();
......
......@@ -48,7 +48,7 @@ int main( int, char** )
auto pS = std::make_shared< CEmitter >( VistaVector3D( -2.0f, 0.0f, 0.0f ) );
auto pR = std::make_shared< CSensor >( VistaVector3D( 2.0f, 0.0f, 0.0f ) );
auto pW = std::make_shared< CITADiffractionWedgeAperture >();
auto pW = std::make_shared< CITADiffractionWedgeApertureBase >();
pW->v3AperturePoint.SetValues( 0.0f, 1.0f, 0.0f );
pW->v3MainWedgeFaceNormal.SetValues( -1.0f, 1.0f, .0f );
pW->v3MainWedgeFaceNormal.Normalize();
......
......@@ -47,7 +47,7 @@ int main( int, char** )
auto pS = std::make_shared< CEmitter >( VistaVector3D( -2.0f, 0.0f, 0.0f ) );
auto pR = std::make_shared< CSensor >( VistaVector3D( 2.0f, 0.0f, 0.0f ) );
auto pW = std::make_shared< CITADiffractionWedgeAperture >();
auto pW = std::make_shared< CITADiffractionWedgeApertureBase >();
pW->v3AperturePoint.SetValues( 0.0f, 1.0f, 0.0f );
pW->v3MainWedgeFaceNormal.SetValues( -1.0f, 1.0f, .0f );
pW->v3MainWedgeFaceNormal.Normalize();
......
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