Commit 50a5eaea authored by Armin Erraji's avatar Armin Erraji

Adjusted UTD.

parent d5f2c46d
......@@ -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 )
{
......
......@@ -16,8 +16,11 @@ 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_cpp.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
......
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