Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
7615cbfb
Commit
7615cbfb
authored
Aug 05, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Using simpler way to determine alpha angles for utd sim
parent
afa0bd83
Changes
4
Hide whitespace changes
Inline
Side-by-side
applications/SoundFieldSimulation/Diffraction/@itaInfiniteWedge/angle_main_face.m
0 → 100644
View file @
7615cbfb
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
applications/SoundFieldSimulation/Diffraction/@itaInfiniteWedge/angle_opposite_face.m
0 → 100644
View file @
7615cbfb
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
applications/SoundFieldSimulation/Diffraction/@itaInfiniteWedge/get_angle_from_point_to_wedge_face.m
View file @
7615cbfb
function
thet
a
=
get_angle_from_point_to_wedge_face
(
obj
,
point
,
use_main_face
)
function
alph
a
=
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
...
...
applications/SoundFieldSimulation/Diffraction/ita_diffraction_utd.m
View file @
7615cbfb
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment