Commit 3c7cb275 by Dipl.-Ing. Jonas Stienen

### Extending diffraction functions to correctly calculate some rare scenarios

parent e3e43bec
 ... ... @@ -21,14 +21,31 @@ end % Auxilary plane spanned by source_receiver_dir and aux_plane_dir (closest % line between aperture vector and source-receiver-vector aux_plane_vec = cross( source_receiver_dir, aperture_dir ); aux_plane_dir = aux_plane_vec / norm( aux_plane_vec ); aux_plane_normal = cross( source_receiver_dir, aux_plane_dir ); % Determine intersection of line (aperture) and auxiliary plane lambda_divisor = dot( aux_plane_normal, aperture_dir ); assert( lambda_divisor ~= 0 ) d = dot( aux_plane_normal, obj.location ); % Distance to origin lambda = ( d - dot( aux_plane_normal, obj.location ) ) / lambda_divisor; aperture_point = obj.location + lambda * aperture_dir; if norm( aux_plane_vec ) ~= 0 % Directions are no parallel, a closest point must exist aux_plane_dir = aux_plane_vec / norm( aux_plane_vec ); aux_plane_normal = cross( source_receiver_dir, aux_plane_dir ); % Determine intersection of line (aperture) and auxiliary plane lambda_divisor = dot( aux_plane_normal, aperture_dir ); assert( lambda_divisor ~= 0 ) d = dot( aux_plane_normal, obj.location ); % Distance to origin lambda = ( d - dot( aux_plane_normal, obj.location ) ) / lambda_divisor; aperture_point = obj.location + lambda * aperture_dir; else % Directions are parallel, project middle point between souce & target % onto aperture % Project middle point onto aperture lambda = dot( ( source_pos + source_receiver_vec ./ 2 )' - obj.location, aperture_dir ); aperture_point = obj.location + lambda * aperture_dir; end assert( any( ~isnan( aperture_point ) ) ) end \ No newline at end of file