Skip to content
Snippets Groups Projects
Commit c843a0ca authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Feat: adapt diffraction check to test for ESEA

parent cd1cb406
Branches
Tags
2 merge requests!3Add unit tests for the IEM,!2Rework of the geometry loading and material system
......@@ -123,18 +123,21 @@ inline void checkDiffraction( const ITAGeo::CPropagationPath diffracted_path, co
REQUIRE( diffracted_path.at( 0 )->v3InteractionPoint == parameters.source_position );
REQUIRE( diffracted_path.at( 2 )->v3InteractionPoint == parameters.receiver_position );
const auto sound_path_direction = parameters.receiver_position - parameters.source_position;
const float t = -parameters.source_position[2] / sound_path_direction[2];
// Check that the ESEA is fulfilled. Ref Tsingos 2001 "Modeling ..."
auto source_2_interaction = parameters.source_position - diffracted_path.at( 1 )->v3InteractionPoint;
auto receiver_2_interaction = parameters.receiver_position - diffracted_path.at( 1 )->v3InteractionPoint;
const auto intersection_xy_plane = parameters.source_position + t * sound_path_direction;
source_2_interaction.Normalize( );
receiver_2_interaction.Normalize( );
const auto interaction_point = VistaVector3D( intersection_xy_plane[0], 0.f, 0.f );
const auto esea_lhs = source_2_interaction.Dot( VistaVector3D( 1, 0, 0 ) );
const auto esea_rhs = receiver_2_interaction.Dot( VistaVector3D( -1, 0, 0 ) );
for( int i = 0; i < 3; ++i )
{
INFO( "Current i: " << i );
REQUIRE_THAT( diffracted_path.at( 1 )->v3InteractionPoint[i], Catch::Matchers::WithinAbs( interaction_point[i], 1e-4 ) ); // 0.1mm accuracy
}
const float pi = 3.14159265358979323846264338327950288419716939937510582097;
INFO( "Difference = " << ( esea_lhs - esea_rhs ) * 180 / pi << "deg" );
REQUIRE_THAT( esea_lhs, Catch::Matchers::WithinAbs( esea_rhs, 1 * pi / 180 ) ); // 1 deg accuracy
}
#endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment