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

WIP

parent 7232019b
function in_reflection_zone = ita_diffraction_reflection_zone( wedge, source_pos, receiver_pos, use_main_face )
%ITA_DIFFRACTION_REFLECTION_ZONE Returns true if receiver is, from the source's
%point of view, in the reflection zone of wedge's main (use_main_face = true) or opposite face
%
% Example: in_reflection_zone = ita_diffraction_reflection_zone( wedge, source_pos, receiver_pos, use_main_face )
%
%% Assertions
if ~numel( source_pos ) == 3
error( 'Source point must be of dimension 3')
end
if ~numel( receiver_pos )
error( 'Receiver point must be of dimension 3')
end
if use_main_face
n = wedge.main_face_normal;
cs_sign = 1;
else
n = wedge.opposite_face_normal;
cs_sign = -1;
end
%% Validations
source_distance = dot( n, source_pos - wedge.location );
source_pos_above_main_plane = ( source_distance >= 0 );
receiver_distance = dot( n, receiver_pos - wedge.location );
receiver_pos_above_main_face = ( receiver_distance >= 0 );
if ~source_pos_above_main_plane || ~receiver_pos_above_main_face
in_reflection_zone = false;
return;
end
% Point-
source_pos_proj = source_pos - source_distance * n;
receiver_pos_proj = receiver_pos - receiver_distance * n;
t = source_distance / ( source_distance + receiver_distance );
intersection_point = source_pos_proj + ( receiver_pos_proj - source_pos_proj ) * t;
e_z = cs_sign * cross( n, wedge.aperture_direction );
if dot( e_z, intersection_point - wedge.location ) >= 0
% Intersection point lies to the left of aperture on wedge face ->
% valid reflection
in_reflection_zone = true;
else
in_reflection_zone = false;
end
end
......@@ -38,7 +38,7 @@ utd_tf.channelNames = { 'Diffracted field (shadow)', 'Diffracted field (illumina
%utd_tf.pf
%% Trajectories
%% Trajectory rotational movement
receiver_start_pos = 5 * [ -1 -1 0 ] / sqrt( 2 );
......@@ -66,11 +66,66 @@ for n = 1 : N
r_dir = norm( receiver_pos - source_pos );
H_direct_field = 1 ./ r_dir .* exp( -1i .* k .* r_dir );
rcv_in_shadow_zone = ita_diffraction_shadow_zone( w, source_pos, receiver_pos );
shadow_zone = ita_diffraction_shadow_zone( w, source_pos, receiver_pos );
% UTD total wave field
H_diffracted_field = ita_diffraction_utd( w, source_pos, receiver_pos, freq, c );
if rcv_in_shadow_zone
if shadow_zone
H_total_field = H_diffracted_field;
else
H_total_field = H_diffracted_field + H_direct_field;
end
H_diffracted_field_log = [ H_diffracted_field_log, H_total_field ./ H_direct_field ];
end
figure
plot( db( H_diffracted_field_log( :, : )' ) )
%% Trajectory rotational vertical
freq = [ 20, 200, 2000, 20000 ]';
k = 2 * pi * freq ./ c;
w = itaInfiniteWedge( [ 1 0 0 ], [ 0 1 0 ], [ 0 0 0 ] ); % OpenGL coordinates
num_positions = 199;
receiver_pos = [ -3, 3, 0 ];
% Set different receiver positions rotated around the aperture
source_positions = [ 3 * ones( num_positions, 1 ), 3 * linspace( 2, -2, num_positions )', zeros( num_positions, 1 ) ];
H_diffracted_field_log = [];
N = size( source_positions, 1 );
for n = 1 : N
source_pos = source_positions( n, : );
r_dir = norm( receiver_pos - source_pos );
H_direct_field = 1 ./ r_dir .* exp( -1i .* k .* r_dir );
shadow_zone = ita_diffraction_shadow_zone( w, source_pos, receiver_pos );
reflection_zone_main = ita_diffraction_reflection_zone( w, source_pos, receiver_pos, false );
if n > 1
if shadow_zone_last ~= shadow_zone
fprintf( 'Shadow zone transition at frame %i\n', n )
%ita_diffraction_visualize_scene( w, source_pos, receiver_pos, true )
end
if reflection_zone_main_last ~= reflection_zone_main
fprintf( 'Opposite reflection zone transition at frame %i\n', n )
%ita_diffraction_visualize_scene( w, source_pos, receiver_pos, true )
end
end
shadow_zone_last = shadow_zone;
reflection_zone_main_last = reflection_zone_main;
% UTD total wave field
H_diffracted_field = ita_diffraction_utd( w, source_pos, receiver_pos, freq, c );
if shadow_zone
H_total_field = H_diffracted_field;
else
H_total_field = H_diffracted_field + H_direct_field;
......
......@@ -33,3 +33,23 @@ assert( ~ita_diffraction_shadow_zone( screen, source, source ) )
assert( ~ita_diffraction_shadow_zone( screen, receiver, receiver ) )
disp 'Shadow zone test successfull'
%% Reflection zone test
source = [ 1 0 0 ];
receiver = [ +0.001 1 0 ];
assert( ita_diffraction_reflection_zone_main( wedge, source, receiver ) )
assert( ita_diffraction_reflection_zone_main( wedge, receiver, source ) )
assert( ita_diffraction_reflection_zone_main( wedge, source, source ) )
assert( ~ita_diffraction_reflection_zone_main( wedge, receiver, receiver ) )
source = [ 1 0 0 ];
receiver = [ -0.001 1 0 ];
assert( ~ita_diffraction_reflection_zone_main( wedge, source, receiver ) )
assert( ~ita_diffraction_reflection_zone_main( wedge, receiver, source ) )
disp 'Main reflection zone test successfull'
Supports Markdown
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