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

Finalizing refactoring for now

parent bd3aa166
......@@ -19,11 +19,11 @@
* ----------------------------------------------------------------
*/
#include <ITAPropagationModelsBase.h>
#include <ITAPropagationModels/Base.h>
#include <ITAPropagationModelKirchhoff.h>
#include <ITAPropagationModelUTD.h>
#include <ITAPropagationModelSvensson.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAPropagationModels/UTD.h>
#include <ITAPropagationModels/Svensson.h>
#include <ITAGeoBase.h>
#include <ITAGeoModelBase.h>
......@@ -45,6 +45,7 @@
#include <iostream>
using namespace std;
using namespace ITAPropagationModels;
float g_fSpeedOfSound = 344.0f;
float g_fSampleRate = 44.1e3;
......@@ -107,7 +108,7 @@ void benchmark_single_wedge()
// Kirchhoff
if( !ITADiffractionKirchhoff::IsApplicable( oPropPath ) )
if( Kirchhoff::IsApplicable( oPropPath ) )
ITA_EXCEPT_INVALID_PARAMETER( "Kirchhoff model can not be applied for this propagation path." );
ITAStopWatch sw;
......@@ -118,7 +119,7 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e8; i++ )
{
sw.start();
ITADiffractionKirchhoff::CalculateDiffractionFilter( oPropPath, oTF, g_fSpeedOfSound );
Kirchhoff::CalculateDiffractionFilter( oPropPath, oTF, g_fSpeedOfSound );
sw.stop();
}
double dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -131,11 +132,11 @@ void benchmark_single_wedge()
sw.reset();
cout << "Starting UTD model benchmark:" << endl;
dStartTime = ITAClock::getDefaultClock()->getTime();
const int iMethod = ITADiffractionUTD::UTD_APPROX_KAWAI_KOUYOUMJIAN;
const int iMethod = UTD::UTD_APPROX_KAWAI_KOUYOUMJIAN;
for( int i = 0; i < 1e6; i++ )
{
sw.start();
ITADiffractionUTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oTF, iMethod, g_fSpeedOfSound);
UTD::CalculateDiffractionFilter(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oTF, iMethod, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......@@ -155,7 +156,7 @@ void benchmark_single_wedge()
for( int i = 0; i < 1e4; i++ )
{
sw.start();
ITADiffractionSvensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oIR, g_fSpeedOfSound);
Svensson::CalculateDiffractionIR(oSource->v3InteractionPoint, oReceiver->v3InteractionPoint, oWedge, oIR, g_fSpeedOfSound);
sw.stop();
}
dStopTime = ITAClock::getDefaultClock()->getTime();
......
......@@ -19,7 +19,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODEL_BASE
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODEL_BASE
namespace ITAPropagationModel
namespace ITAPropagationModels
{
}
......
......@@ -24,18 +24,22 @@
// ITA includes
#include <ITASampleBuffer.h>
//! Diffraction filter impulse response in time domain
/**
*
* Because only the diffraction part is described, leading
* zeros from the propagation delay is discarded in the IR.
*/
class ITA_PROPAGATION_MODELS_API CITADiffractionFilter
namespace ITAPropagationModels
{
CITADiffractionFilter();
ITASampleBuffer sbFIRFilter;
int nLeadingZeros;
int nFilterLength;
};
//! Diffraction filter impulse response in time domain
/**
*
* Because only the diffraction part is described, leading
* zeros from the propagation delay is discarded in the IR.
*/
class ITA_PROPAGATION_MODELS_API CITADiffractionFilter
{
CITADiffractionFilter();
ITASampleBuffer sbFIRFilter;
int nLeadingZeros;
int nFilterLength;
};
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_FILTER
......@@ -65,7 +65,8 @@ namespace ITAPropagationModels
inline void GenerateTF( ITABase::CHDFTSpectrum& pTransferFunction )
{
const std::vector< ITABase::CHDFTSpectrum* > vpSpectra = { &( pTransferFunction ) };
GenerateTF( ITABase::CHDFTSpectra( vpSpectra ) );
ITABase::CHDFTSpectra oTF( vpSpectra );
GenerateTF( oTF );
};
//! Generate a multi-channel transfer function
......
......@@ -22,7 +22,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_KIRCHHOFF
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_KIRCHHOFF
#include <ITAPropagationModelsDefinitions.h>
#include "ITAPropagationModels/Definitions.h"
// ITA includes
#include <ITAConstants.h>
......@@ -33,142 +33,145 @@
// STL includes
#include <cassert>
//! Diffraction calculation based on Kirchhoff approximation
/**
* @sa Pierce, A. D.; Diffraction of sound around corners and over wide barriers; J. Acoust. Soc. Am., 1974, 55, 941-955
*/
namespace ITADiffractionKirchhoff
namespace ITAPropagationModels
{
//! Validates if Kirchhoff diffraction method can be applied
//! Diffraction calculation based on Kirchhoff approximation
/**
* The Kirchhoff detour method only makes sense if the source is
* occluded by obstacles in it's way to the receiver (or vice versa).
* This may include specular reflections, but inverse wedges (corners) have to
* be excluded because they can not occlude entities.
*
* @param[in] oPropPath Propagation path to be simulated
* @return True, if Kirchhoff can be used (makes sense for this path)
*
* @sa KirchhoffDetourAndLength
* @sa KirchhoffDiffractionFilter
*
* @note Throws ITAException on error
*
* @sa Pierce, A. D.; Diffraction of sound around corners and over wide barriers; J. Acoust. Soc. Am., 1974, 55, 941-955
*/
bool ITA_PROPAGATION_MODELS_API IsApplicable( const ITAGeo::CPropagationPath& oPropPath );
//! Calculates the detour of a propagation path for the Kirchhoff method
/**
* Calculates the direct path vs. detour path by taking diffraction anchors into account.
* It is recommended to validate the path, first. Otherwise unpredictable results will occur.
*
* 1. Specular reflections will increase the direct path length AND detour length
* 2. Only diffraction around a wedge are treated (diffraction angle greater \pi, where 0 would be back-scattering and \pi is gracing angle)
*
* @param[in] oPropPath Propagation path to be simulated
* @param[out] dPropagationLengthDirect Propagation path length without occlusion [m]
* @param[out] dPropagationLengthDetour Propagation path detour length with occlusion [m]
*
* @sa IsKirchhoffApplicable
*
* @note Throws ITAException on error
*
*/
void ITA_PROPAGATION_MODELS_API GetDirectLengthAndDetourLength( const ITAGeo::CPropagationPath& oPropPath, double& dPropagationLengthDirect, double& dPropagationLengthDetour );
//! Calculates the detour-and-direct-path difference of a propagation path for the Kirchhoff method
/**
* @param[in] dPropagationLengthDirect Direct path length [m] (sometimes referred to as 'd')
* @param[in] dPropagationLengthDetour Detour path length [m] (sometimes referred to as 'A+B')
*
* @return Kirchhoff delta (difference) [m] (\delta, sometimes referred to as 'A+B-d')
*
* @note Throws ITAException on error
*
*/
double ITA_PROPAGATION_MODELS_API KirchhoffDelta( const double dPropagationLengthDirect, const double dPropagationLengthDetour );
//! Calculates the detour-and-direct-path inverse difference factor of a propagation path for the Kirchhoff method
/**
* @return Kirchhoff delta factor (ratio), always greater or equal 1.0
*
* @note Throws ITAException on error
*
*/
inline double KirchhoffDeltaInverseFactor( const double dPropagationLengthDirect, const double dPropagationLengthDetour )
{
const double dKirchhoffDelta = ITADiffractionKirchhoff::KirchhoffDelta( dPropagationLengthDirect, dPropagationLengthDetour );
const double dKirchhoffDeltaInverseFactor = ( dPropagationLengthDirect + dKirchhoffDelta ) / dPropagationLengthDirect;
return dKirchhoffDeltaInverseFactor;
};
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and withont any obstacles.
*
* @param[in] dPropagationLengthDirect Direct path length [m]
* @param[in] dPropagationLengthDetour Detour path length [m]
* @param[out] oTransferFunction Destination filter of simulation (zero-phase frequency domain magnitude spectrum)
*
*/
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const double dPropagationLengthDirect, const double dPropagationLengthDetour, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f );
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method for a single wedge
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
*
* @param[in] oPropPath Propagation path
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
*
* @note Throws ITAException on error
*
*/
inline bool CalculateDiffractionFilter( const ITAGeo::CPropagationPath& oPropPath, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f )
{
if( !ITADiffractionKirchhoff::IsApplicable( oPropPath ) )
return false;
double dDirect, dDetour;
ITADiffractionKirchhoff::GetDirectLengthAndDetourLength( oPropPath, dDirect, dDetour );
ITADiffractionKirchhoff::CalculateDiffractionFilter( dDirect, dDetour, oTransferFunction, fSpeedOfSound );
return true;
};
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method for a single wedge
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
*
* @param[in] pSource Source of propagation (previous anchor point of path)
* @param[in] pWedge Diffraction wedge of propagation
* @param[in] pTarget Target of propagation (next anchor point of path)
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
*
* @note Throws ITAException on error
*
*/
inline bool CalculateDiffractionFilter( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CITADiffractionWedgeAperture > pWedge, std::shared_ptr< ITAGeo::CPropagationAnchor > pTarget, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f )
namespace Kirchhoff
{
if( !pWedge->IsOccluding( pSource, pTarget ) )
return false;
// A little dirty removing const, but we know what we are doing, here.
ITAGeo::CPropagationPath oPropPath;
oPropPath.push_back( pSource );
oPropPath.push_back( pWedge );
oPropPath.push_back( pTarget );
const ITAGeo::CPropagationPath& oConstPropPath( oPropPath ); // Not necessary, just making a point
return CalculateDiffractionFilter( oConstPropPath, oTransferFunction, fSpeedOfSound );
};
//! Validates if Kirchhoff diffraction method can be applied
/**
* The Kirchhoff detour method only makes sense if the source is
* occluded by obstacles in it's way to the receiver (or vice versa).
* This may include specular reflections, but inverse wedges (corners) have to
* be excluded because they can not occlude entities.
*
* @param[in] oPropPath Propagation path to be simulated
* @return True, if Kirchhoff can be used (makes sense for this path)
*
* @sa KirchhoffDetourAndLength
* @sa KirchhoffDiffractionFilter
*
* @note Throws ITAException on error
*
*/
bool ITA_PROPAGATION_MODELS_API IsApplicable( const ITAGeo::CPropagationPath& oPropPath );
//! Calculates the detour of a propagation path for the Kirchhoff method
/**
* Calculates the direct path vs. detour path by taking diffraction anchors into account.
* It is recommended to validate the path, first. Otherwise unpredictable results will occur.
*
* 1. Specular reflections will increase the direct path length AND detour length
* 2. Only diffraction around a wedge are treated (diffraction angle greater \pi, where 0 would be back-scattering and \pi is gracing angle)
*
* @param[in] oPropPath Propagation path to be simulated
* @param[out] dPropagationLengthDirect Propagation path length without occlusion [m]
* @param[out] dPropagationLengthDetour Propagation path detour length with occlusion [m]
*
* @sa IsKirchhoffApplicable
*
* @note Throws ITAException on error
*
*/
void ITA_PROPAGATION_MODELS_API GetDirectLengthAndDetourLength( const ITAGeo::CPropagationPath& oPropPath, double& dPropagationLengthDirect, double& dPropagationLengthDetour );
//! Calculates the detour-and-direct-path difference of a propagation path for the Kirchhoff method
/**
* @param[in] dPropagationLengthDirect Direct path length [m] (sometimes referred to as 'd')
* @param[in] dPropagationLengthDetour Detour path length [m] (sometimes referred to as 'A+B')
*
* @return Kirchhoff delta (difference) [m] (\delta, sometimes referred to as 'A+B-d')
*
* @note Throws ITAException on error
*
*/
double ITA_PROPAGATION_MODELS_API KirchhoffDelta( const double dPropagationLengthDirect, const double dPropagationLengthDetour );
//! Calculates the detour-and-direct-path inverse difference factor of a propagation path for the Kirchhoff method
/**
* @return Kirchhoff delta factor (ratio), always greater or equal 1.0
*
* @note Throws ITAException on error
*
*/
inline double KirchhoffDeltaInverseFactor( const double dPropagationLengthDirect, const double dPropagationLengthDetour )
{
const double dKirchhoffDelta = Kirchhoff::KirchhoffDelta( dPropagationLengthDirect, dPropagationLengthDetour );
const double dKirchhoffDeltaInverseFactor = ( dPropagationLengthDirect + dKirchhoffDelta ) / dPropagationLengthDirect;
return dKirchhoffDeltaInverseFactor;
};
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and withont any obstacles.
*
* @param[in] dPropagationLengthDirect Direct path length [m]
* @param[in] dPropagationLengthDetour Detour path length [m]
* @param[out] oTransferFunction Destination filter of simulation (zero-phase frequency domain magnitude spectrum)
*
*/
void ITA_PROPAGATION_MODELS_API CalculateDiffractionFilter( const double dPropagationLengthDirect, const double dPropagationLengthDetour, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f );
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method for a single wedge
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
*
* @param[in] oPropPath Propagation path
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
*
* @note Throws ITAException on error
*
*/
inline bool CalculateDiffractionFilter( const ITAGeo::CPropagationPath& oPropPath, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f )
{
if( !Kirchhoff::IsApplicable( oPropPath ) )
return false;
double dDirect, dDetour;
Kirchhoff::GetDirectLengthAndDetourLength( oPropPath, dDirect, dDetour );
Kirchhoff::CalculateDiffractionFilter( dDirect, dDetour, oTransferFunction, fSpeedOfSound );
return true;
};
//! Calculate diffraction filter (frequency domain) based on the Kirchhoff detour method for a single wedge
/**
* This function calculates the Kirchhoff diffraction filter based on detour length around a wedge obstacle
* and the direct path length with and without any obstacles.
*
* @param[in] pSource Source of propagation (previous anchor point of path)
* @param[in] pWedge Diffraction wedge of propagation
* @param[in] pTarget Target of propagation (next anchor point of path)
* @param[out] oTransferFunction Destination filter of simulation (frequency domain)
*
* @return True, if Kirchhoff method could be applied
*
* @note Throws ITAException on error
*
*/
inline bool CalculateDiffractionFilter( std::shared_ptr< ITAGeo::CPropagationAnchor > pSource, std::shared_ptr< ITAGeo::CITADiffractionWedgeAperture > pWedge, std::shared_ptr< ITAGeo::CPropagationAnchor > pTarget, ITABase::CHDFTSpectrum& oTransferFunction, const float fSpeedOfSound = 344.0f )
{
if( !pWedge->IsOccluding( pSource, pTarget ) )
return false;
// A little dirty removing const, but we know what we are doing, here.
ITAGeo::CPropagationPath oPropPath;
oPropPath.push_back( pSource );
oPropPath.push_back( pWedge );
oPropPath.push_back( pTarget );
const ITAGeo::CPropagationPath& oConstPropPath( oPropPath ); // Not necessary, just making a point
return CalculateDiffractionFilter( oConstPropPath, oTransferFunction, fSpeedOfSound );
};
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_KIRCHHOFF
......@@ -22,7 +22,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
#include <ITAPropagationModelsDefinitions.h>
#include "Definitions.h"
// Vista includes
#include <VistaBase/VistaVector3D.h>
......@@ -34,20 +34,23 @@
#include <ITAFiniteImpulseResponse.h>
namespace ITADiffractionSvensson
namespace ITAPropagationModels
{
//! Calculates the impulse response of Svensson diffraction model for a given constellation
/**
* @sa Svensson, P.; Fred, R. & Vanderkooy, J.; An analytic secondary source model of edge diffraction impulse responses; J. Acoust. Soc. Am., 1999, 106, 2331
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oEffectiveDiffractionIR Effective impulse response for diffraction part of sound path from source to target (not including delay)
*
* @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 = 344.0f );
};
namespace Svensson
{
//! Calculates the impulse response of Svensson diffraction model for a given constellation
/**
* @sa Svensson, P.; Fred, R. & Vanderkooy, J.; An analytic secondary source model of edge diffraction impulse responses; J. Acoust. Soc. Am., 1999, 106, 2331
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oEffectiveDiffractionIR Effective impulse response for diffraction part of sound path from source to target (not including delay)
*
* @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 = 344.0f );
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_SVENSSON
......@@ -21,7 +21,7 @@
#ifndef INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#define INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#include <ITAPropagationModelsDefinitions.h>
#include "Definitions.h"
// Vista includes
#include <VistaBase/VistaVector3D.h>
......@@ -35,47 +35,50 @@
// STL includes
#include <ccomplex>
namespace ITADiffractionUTD
namespace ITAPropagationModels
{
//! UTD diffraction coefficient calculation methods (only approximation implemented yet!)
enum UTD_DIFFRACTION_ALGORITHM
namespace UTD
{
UTD_FRESNEL_INTEGRAL_FORM = 1, //!< Solve Fresnel integral over komplex value (not implemented yet!)
UTD_APPROX_KAWAI_KOUYOUMJIAN = 2, //!< Skip integral solution and use approximations
};
//! UTD diffraction coefficient calculation methods (only approximation implemented yet!)
enum UTD_DIFFRACTION_ALGORITHM
{
UTD_FRESNEL_INTEGRAL_FORM = 1, //!< Solve Fresnel integral over komplex value (not implemented yet!)
UTD_APPROX_KAWAI_KOUYOUMJIAN = 2, //!< Skip integral solution and use approximations
};
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationPath& vPath, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationAnchor& oSource, const CITAGeoPropagationAnchor& oTarget, const CITADiffractionWedgeAperture& oApex, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//! Calculates the complex valued UTD diffraction coefficient for a given constellation and wave number
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[in] fWaveNumber Wave number ( k )
* @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 GenerateUTDDiffractionFilter( const CITAGeoPropagationPath& vPath, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//ITA_PROPAGATION_MODELS_API bool GenerateUTDDiffractionFilter( const CITAGeoPropagationAnchor& oSource, const CITAGeoPropagationAnchor& oTarget, const CITADiffractionWedgeAperture& oApex, ITAHDFTSpectrum& oDiffractionAttenuationSpectrum );
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oTF Diffraction transfer function / filter in frequency domain
* @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 = 344.0f );
};
//! Calculates the complex valued UTD diffraction coefficient for a given constellation and wave number
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[in] fWaveNumber Wave number ( k )
* @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 );
//! Calculates the UTD diffraction filter in frequency domain for a given constellation
/**
* @sa Tsingos, N.; Funkhouser, T.; Ngan, A. & Carlbom, I.; Modeling Acoustics in Virtual Environments Using the Uniform Theory of Diffraction; Proceedings of the 28th Annual Conference on Computer Graphics and Interactive Techniques, ACM, 2001, 545-552
* @sa Kouyoumjian, R. G. & Pathak, P. H.; A uniform geometrical theory of diffraction for an edge in a perfectly conducting surface; Proceedings of the IEEE, IEEE, 1974, 62, 1448-1461
* @sa Kawai, T.; Sound diffraction by a many-sided barrier or pillar; Journal of Sound Vibration, 1981, 79, 229-242
*
* @param[in] v3SourcePos Source position (outside wedge), rojected position may have to be used for correct distances!
* @param[in] v3TargetPos target position (outside wedge)
* @param[in] pApex Aperture point including wedge parameters (angles, etc)
* @param[out] oTF Diffraction transfer function / filter in frequency domain
* @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 = 344.0f );
}
}
#endif // INCLUDE_WATCHER_ITA_PROPAGATION_MODELS_UTD
#include <ITAPropagationModelFilterGenerator.h>
#include <ITAPropagationModels/FilterGenerator.h>
// ITA includes
#include <ITAException.h>
......@@ -11,17 +11,4 @@
#include <assert.h>
#include <stdio.h>
using namespace ITAGeo;
CITADiffractionFilterGenerator::CITADiffractionFilterGenerator( int iModel )
: m_iModel( iModel )
{
}
/* see @todo
void CITAFilterGenerator::GenerateFIR( const CPropagationAnchor& oSource, const CPropagationAnchor& oDestination, CITADiffractionWedgeAperture& oWedge, CITADiffractionFilter& oFilter )
{
}
*/
\ No newline at end of file
using namespace ITAPropagationModels;
......@@ -14,8 +14,12 @@
using namespace ITAGeo;
using namespace ITAPropagationModels;
CTFGenerator::CFilterGenerator( int iModel )
: m_iModel( iModel )
ITAPropagationModels::CTFGenerator::CTFGenerator( const int iNumOutputChannels, const int iDFTSize /*= 128 */ )
{
}
void ITAPropagationModels::CTFGenerator::GenerateTF( ITABase::CHDFTSpectra& pTransferFunctions )
{
}
#include <ITAPropagationModelKirchhoff.h>
#include <ITAPropagationModels/Kirchhoff.h>
#include <ITAException.h>
using namespace ITAGeo;
using namespace ITAPropagationModels;
bool ITADiffractionKirchhoff::IsApplicable( const CPropagationPath& oPropPath )
bool Kirchhoff::IsApplicable( const CPropagationPath& oPropPath )
{
if( oPropPath.size() < 3 )
ITA_EXCEPT1( INVALID_PARAMETER, "Propagation path needs at least 3 anchors for Kirchhoff method" );
......@@ -40,7 +42,7 @@ bool ITADiffractionKirchhoff::IsApplicable( const CPropagationPath& oPropPath )