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

Merge branch 'ma_2018/erraji' into develop

parents bc46499d b68b1620
......@@ -80,10 +80,10 @@ bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, con
const float L = rho * r / ( rho + r ) * sin( theta_i ) * sin( theta_i ); // Spherical wave distance parameter
const float fCotArg1 = PI_F + ( fAlphaDiff ) / ( 2.0f * n );
const float fCotArg2 = PI_F - ( fAlphaDiff ) / ( 2.0f * n );
const float fCotArg3 = PI_F + ( fAlphaSum ) / ( 2.0f * n );
const float fCotArg4 = PI_F - ( fAlphaSum ) / ( 2.0f * n );
const float fCotArg1 = (PI_F + fAlphaDiff ) / ( 2.0f * n );
const float fCotArg2 = (PI_F - fAlphaDiff ) / ( 2.0f * n );
const float fCotArg3 = (PI_F + fAlphaSum ) / ( 2.0f * n );
const float fCotArg4 = (PI_F - fAlphaSum ) / ( 2.0f * n );
std::complex< float > cfTerm1, cfTerm2, cfTerm3, cfTerm4;
if( iMethod == UTD_APPROX_KAWAI_KOUYOUMJIAN )
......@@ -94,7 +94,7 @@ bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, con
if( fmodf( std::abs( fAlphaDiff ), PI_F ) < fAngleThresholdSingularityRad || fmodf( std::abs( fAlphaSum ), PI_F ) < fAngleThresholdSingularityRad )
{
// Kouyoumjian approx
ITA_EXCEPT_NOT_IMPLEMENTED;
const float fEpsilon = 0.0f; // @todo
const float fEpsilonSignum = fEpsilon > 0 ? 1.0f : -1.0f;
cfTerm1 = n * exp( -j * PI_F / 4.0f ) *( sqrt( 2.0f * PI_F * k * L ) * fEpsilonSignum - 2.0f * k * L * fEpsilon * exp( -j * PI_F / 4.0f ) );
......@@ -106,14 +106,14 @@ bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, con
{
// Kawai approx, equation 22
const float fX1 = k * L * UTDHelperFunction_a_plus(fAlphaSum, n );
cfTerm1 = 1.0f / tan( fCotArg1 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX1 );
const float fX2 = k * L * UTDHelperFunction_a_minus(fAlphaSum, n );
cfTerm2 = 1.0f / tan( fCotArg2 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX2 );
const float fX3 = k * L * UTDHelperFunction_a_plus(fAlphaDiff, n );
cfTerm3 = 1.0f / tan( fCotArg3 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX3 );
const float fX4 = k * L * UTDHelperFunction_a_minus(fAlphaDiff, n );
cfTerm4 = 1.0f / tan( fCotArg4 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX4 );
const float fX1 = k * L * UTDHelperFunction_a_plus(fAlphaDiff, n );
cfTerm1 = tan(PI_F / 2.0f - fCotArg1 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX1 );
const float fX2 = k * L * UTDHelperFunction_a_minus(fAlphaDiff, n );
cfTerm2 = tan(PI_F / 2.0f - fCotArg2 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX2 );
const float fX3 = k * L * UTDHelperFunction_a_plus(fAlphaSum, n );
cfTerm3 = tan(PI_F / 2.0f - fCotArg3 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX3 );
const float fX4 = k * L * UTDHelperFunction_a_minus(fAlphaSum, n );
cfTerm4 = tan(PI_F / 2.0f - fCotArg4 ) * UTDHelperFunctionKawaiApproximationFresnelIntegral( fX4 );
}
}
else if( iMethod == UTD_FRESNEL_INTEGRAL_FORM )
......@@ -141,7 +141,7 @@ bool UTD::CalculateDiffractionCoefficient( const VistaVector3D& v3SourcePos, con
float fA = sqrt(rho / (r*(rho + r)))*sin(theta_i);
//Complete diffraction coefficient with A and influence of rho
cfCoeff = cfD * fA /rho;
cfCoeff = cfD * fA /rho * exp(-j*k*(rho+r));
return true;
}
......@@ -172,7 +172,7 @@ complex< float > UTDHelperFunctionKawaiApproximationFresnelIntegral( const float
return 0.0f;
//Phase term is always the same
const complex< float > cfTermPhase = exp(j * PI_F / 4.0f *(1 - sqrt(fX / (fX + 1.4f))));
const complex< float > cfTermPhase = exp(-j * PI_F / 4.0f *(1 - sqrt(fX / (fX + 1.4f))));
if( fX < 0.8f )
{
......
......@@ -33,18 +33,9 @@ using namespace ITAPropagationModels;
int main( int, char** )
{
/*
|___x___|
/\
s \ r
\ /
___x___
|______|
*/
auto pSender = make_shared< CEmitter >( VistaVector3D( -2.0f, 0.0f, 0.0f ) );
auto pSource = make_shared< CEmitter >( VistaVector3D( -2.0f, 0.0f, 0.0f ) );
auto pReceiver = make_shared< CSensor >( VistaVector3D( 2.0f, 0.0f, 0.0f ) );
auto pMaterialDirectory = std::make_shared< Material::CDirectory >( "./" );
......@@ -61,16 +52,16 @@ int main( int, char** )
pW->v3VertextEnd.SetValues( .0f, 1.0f, 1.0f );
CPropagationPath oPathDirect;
oPathDirect.push_back( pSender );
oPathDirect.push_back( pSource );
oPathDirect.push_back( pReceiver );
CPropagationPath oPathReflection;
oPathReflection.push_back( pSender );
oPathReflection.push_back( pSource );
oPathReflection.push_back( pReflection );
oPathReflection.push_back( pReceiver );
CPropagationPath oPathDiffraction;
oPathDiffraction.push_back( pSender );
oPathDiffraction.push_back( pSource );
oPathDiffraction.push_back( pW );
oPathDiffraction.push_back( pReceiver );
......
......@@ -16,9 +16,12 @@ c = 344.0;
utd_ir = utd_ir_cpp;
utd_ir.freqData = ita_diffraction_utd( w, s, r, utd_ir_cpp.freqVector, c );
maekawa_ir = utd_ir_cpp;
maekawa_ir.freqData = ita_diffraction_maekawa( w, s, r, maekawa_ir.freqVector, c );
%% Combined result
maekawa_eval = ita_merge( utd_ir, utd_ir_cpp );
maekawa_eval = ita_merge( utd_ir, utd_ir_cpp, maekawa_ir );
%% Plot result
maekawa_eval.pt
\ No newline at end of file
maekawa_eval.pf
\ No newline at end of file
No preview for this file type
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