Commit 802ad45d authored by henryjandrew's avatar henryjandrew
Browse files

added option to manually give apex point to diffraction_utd

parent 0e34ca8f
......@@ -11,7 +11,7 @@ segment_1 = ( point - obj.aperture_start_point );
segment_2 = ( obj.aperture_end_point - point );
diff_norm = obj.length - norm( segment_1 ) - norm( segment_2 );
if diff_norm < obj.set_get_geo_eps
if abs( diff_norm ) > obj.set_get_geo_eps %changed frm < to >, as if point is on aperture, diff_norm should == 0
b = false;
else
b = true;
......
function [ diffr_field, D, A ] = ita_diffraction_utd( wedge, source_pos, receiver_pos, frequency_vec, speed_of_sound )
function [ diffr_field, D, A ] = ita_diffraction_utd( wedge, source_pos, receiver_pos, frequency_vec, speed_of_sound, apex_point )
%ITA_DIFFRACTION_UTD Calculates the diffraction filter based on uniform
%theory of diffraction (with Kawai approximation)
%theory of diffraction (with Kawai approximation). Apex point is optional
%and can
%
% Literature:
% [1] Tsingos, Funkhouser et al. - Modeling Acoustics in Virtual Environments using the Uniform Theory of Diffraction
......@@ -24,8 +25,12 @@ if ~ita_diffraction_point_is_row_vector( receiver_pos )
% receiver_pos = receiver_pos';
end
if nargin < 6
apex_point = wedge.get_aperture_point2( source_pos, receiver_pos );
end
%% Variables
apex_point = wedge.get_aperture_point2( source_pos, receiver_pos ); %changed to new fn to find apereture point with matlab optimisation routine
rho = norm( apex_point - source_pos ); % Distance of source to aperture point
r = norm( receiver_pos - apex_point ); % Distance of receiver to aperture point
assert( rho + r ~= 0 && r ~= 0 );
......
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