Commit 7615cbfb by Dipl.-Ing. Jonas Stienen

### Using simpler way to determine alpha angles for utd sim

parent afa0bd83
 function alpha = angle_main_face( obj, point ) %angle_main_face Returns angle (radiant) between given point and a wedge face. % input: point arbitrary field point outside the wedge. % output: theta azimuth angle (radiant) in cylinder coordinates with % the aperture as z axis. Between [0, 2*pi] if numel( point ) ~= 3 error( 'Point has to be of dimension 3' ); end if ~obj.point_outside_wedge( point ) error 'Point was inside wedge' end % Transform coordinate system into the reference frame of wedge % and use cylinder coordinates e_y = obj.main_face_normal; e_z = obj.aperture_direction; e_x = cross( e_y, e_z ); x_cylinder = dot( point - obj.location, e_x ); y_cylinder = dot( point - obj.location, e_y ); % Calculate angle between incedent ray from source to aperture point and % wedge face alpha = atan2( y_cylinder, x_cylinder ); % Adjust output, range must be between [ 0, 2 * pi ] if alpha < 0 alpha = alpha + 2 * pi; end end
 function alpha = angle_opposite_face( obj, point ) %angle_opposite_face Returns angle (radiant) between given point and the opposite wedge face. % input: point arbitrary field point outside the wedge. % output: theta azimuth angle (radiant) in cylinder coordinates with % the aperture as -z axis. Between [0, 2*pi] alpha = obj.opening_angle - obj.angle_main_face( point ); assert( alpha >= 0 ) end
 function theta = get_angle_from_point_to_wedge_face( obj, point, use_main_face ) function alpha = get_angle_from_point_to_wedge_face( obj, point, use_main_face ) %get_angle_from_point_to_wedge_face Returns angle (radiant) between % given point and a wedge face. % input: point arbitrary field point outside the wedge. ... ... @@ -7,38 +7,10 @@ function theta = get_angle_from_point_to_wedge_face( obj, point, use_main_face ) % output: theta azimuth angle (radiant) in cylinder coordinates with % the aperture as z axis. Between [0, 2*pi] %% Assertions if ~ita_diffraction_point_is_of_dim3( point ) error( 'Point has to be of dimension 3' ); end %{ if any( ~obj.point_outside_wedge( point ) ) commented out! error('Point(s) must be outside the wedge'); end %} if nargin < 3 use_main_face = true; end %% Begin % define cartesian coordinate system if use_main_face e_y = obj.main_face_normal; e_z = obj.aperture_direction; if nargin < 2 || use_main_face alpha = obj.angle_main_face( point ); else e_y = obj.opposite_face_normal; e_z = - obj.aperture_direction; end e_x = cross( e_y, e_z ); % Determine coordinates of point in new coordinate system x_new = dot( point - obj.location, e_x ); y_new = dot( point - obj.location, e_y ); % Calculate angle between incedent ray from source to aperture point and reference wedge side theta = atan2( y_new, x_new ); if theta < 0 theta = theta + 2*pi; % -> output between [0, 2*pi] alpha = obj.angle_opposite_face( point ); end end ... ...
 ... ... @@ -29,9 +29,8 @@ 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 ); %src_facing_main_side = wedge.point_facing_main_side( source_pos ); alpha_i = wedge.get_angle_from_point_to_wedge_face( source_pos, true ); alpha_d = wedge.get_angle_from_point_to_wedge_face( receiver_pos, true ); alpha_i = wedge.angle_main_face( source_pos ); alpha_d = wedge.angle_main_face( receiver_pos ); theta_i = wedge.get_angle_from_point_to_aperture( source_pos, apex_point ); n = wedge.opening_angle / pi; % Variable dependend on opening angle of the wedge ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!