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
c7e92280
Commit
c7e92280
authored
Jan 04, 2021
by
jonasstienen
Browse files
Progress on auto anchor merging
parent
f58f324f
Changes
6
Hide whitespace changes
Inline
Side-by-side
applications/SoundFieldSimulation/Diffraction/@itaInfiniteWedge/get_aperture_point_far_field.m
View file @
c7e92280
...
...
@@ -32,7 +32,7 @@ if norm( aux_plane_vec ) ~= 0
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
;
lambda
=
(
d
-
dot
(
aux_plane_normal
,
source_pos
)
)
;
%
/ lambda_divisor;
% .. or receiver_pos
aperture_point
=
obj
.
location
+
lambda
*
aperture_dir
;
else
...
...
applications/SoundFieldSimulation/PropagationModels/@itaGeoPropagation/tf.m
View file @
c7e92280
...
...
@@ -13,6 +13,7 @@ end
freq_data_linear
=
ones
(
obj
.
num_bins
,
1
);
distance_p
=
ita_propagation_path_length
(
pp
);
fprintf
(
'Path metrics: distance=%.1fm, delay=%.1fms\n'
,
distance_p
,
distance_p
/
obj
.
c
*
1e3
);
if
distance_p
/
obj
.
c
>
2
*
obj
.
num_bins
/
obj
.
fs
error
'Propagation path length too long, increase number of bins to generate transfer function for this propagation path'
end
...
...
applications/SoundFieldSimulation/PropagationModels/@itaGeoPropagation/tf_diffraction.m
View file @
c7e92280
...
...
@@ -42,7 +42,7 @@ if size( effective_receiver_position, 1 ) == 4
end
% Validate
apex_point
=
w
.
get_aperture_point
(
effective_source_position
(
1
:
3
)
'
, effective_receiver_position
( 1:3 )'
);
apex_point
=
w
.
get_aperture_point
_far_field
(
effective_source_position
,
effective_receiver_position
);
if
all
(
apex_point
==
effective_source_position
)
||
...
all
(
apex_point
==
effective_receiver_position
)
warning
(
'Skipping a path segment with a double anchor point'
)
...
...
applications/SoundFieldSimulation/PropagationModels/@itaGeoPropagation/tf_directivity.m
View file @
c7e92280
...
...
@@ -24,9 +24,12 @@ if isa( directivity_data, 'DAFF' )
v
=
wave_front_direction
(
1
:
3
)
/
norm
(
wave_front_direction
(
1
:
3
)
);
q_target
=
quaternion
.
rotateutov
(
[
1
0
0
],
v
);
q_combined
=
q_target
*
conj
(
q_object
);
euler_angles
=
q_combined
.
EulerAngles
(
'ZYX'
);
azi_deg
=
rad2deg
(
real
(
euler_angles
(
1
)
)
);
ele_deg
=
rad2deg
(
real
(
euler_angles
(
2
)
)
);
azi_deg
=
rad2deg
(
+
real
(
euler_angles
(
1
)
)
);
ele_deg
=
rad2deg
(
-
real
(
euler_angles
(
2
)
)
);
fprintf
(
'Directivity used: azimuth=%.1f, elevation=%.1f\n'
,
round
(
azi_deg
,
1
),
round
(
ele_deg
,
1
)
);
idx
=
directivity_data
.
nearest_neighbour_index
(
azi_deg
,
ele_deg
);
if
strcmpi
(
directivity_data
.
properties
.
contentType
,
'ir'
)
...
...
applications/SoundFieldSimulation/PropagationModels/ita_propagation_merge_outer_edge_diffraction.m
View file @
c7e92280
function
merged_outer_edge_diffraction
=
ita_propagation_merge_outer_edge_diffraction
(
a
,
b
)
%ita_propagation_merge_anchors Merges two outer edge diffractions in a best-fit attempt
aperture_dir_a
=
a
.
vertex_end
-
a
.
vertex_start
;
aperture_dir_b
=
b
.
vertex_end
-
b
.
vertex_start
;
if
a
.
main_wedge_face_id
==
b
.
main_wedge_face_id
aperture_dir_a
=
a
.
vertex_end
-
a
.
vertex_start
;
aperture_dir_b
=
b
.
vertex_end
-
b
.
vertex_start
;
if
dot
(
aperture_dir_a
,
aperture_dir_b
)
>
0
% Same direction, construct a centered substitute
else
...
...
@@ -22,9 +22,6 @@ if a.main_wedge_face_id == b.main_wedge_face_id
elseif
a
.
opposite_wedge_face_id
==
b
.
opposite_wedge_face_id
aperture_dir_a
=
a
.
vertex_end
-
a
.
vertex_start
;
aperture_dir_b
=
b
.
vertex_end
-
b
.
vertex_start
;
if
dot
(
aperture_dir_a
,
aperture_dir_b
)
>
0
% Same direction, construct a centered substitute
else
...
...
@@ -41,7 +38,23 @@ elseif a.opposite_wedge_face_id == b.opposite_wedge_face_id
elseif
a
.
main_wedge_face_id
==
b
.
opposite_wedge_face_id
error
(
'todo'
)
if
dot
(
aperture_dir_a
,
aperture_dir_b
)
>
0
% Same direction, construct a centered substitute
merged_outer_edge_diffraction
=
b
;
merged_outer_edge_diffraction
.
opposite_wedge_face_normal
=
a
.
opposite_wedge_face_normal
;
merged_outer_edge_diffraction
.
opposite_wedge_face_id
=
a
.
opposite_wedge_face_id
;
merged_outer_edge_diffraction
.
vertex_start
=
mean
(
[
a
.
vertex_start
,
b
.
vertex_start
],
2
);
merged_outer_edge_diffraction
.
vertex_end
=
mean
(
[
a
.
vertex_end
,
b
.
vertex_end
],
2
);
merged_outer_edge_diffraction
.
interaction_point
=
mean
(
[
a
.
interaction_point
,
b
.
interaction_point
],
2
);
else
% Opposite direction, use main b face
merged_outer_edge_diffraction
=
b
;
merged_outer_edge_diffraction
.
opposite_wedge_face_normal
=
a
.
opposite_wedge_face_normal
;
merged_outer_edge_diffraction
.
opposite_wedge_face_id
=
a
.
opposite_wedge_face_id
;
merged_outer_edge_diffraction
.
vertex_start
=
mean
(
[
b
.
vertex_start
,
a
.
vertex_end
],
2
);
merged_outer_edge_diffraction
.
vertex_end
=
mean
(
[
b
.
vertex_end
,
a
.
vertex_start
],
2
);
merged_outer_edge_diffraction
.
interaction_point
=
mean
(
[
b
.
interaction_point
,
a
.
interaction_point
],
2
);
end
elseif
a
.
opposite_wedge_face_id
==
b
.
main_wedge_face_id
...
...
applications/SoundFieldSimulation/PropagationModels/ita_propagation_paths_merge_anchors.m
View file @
c7e92280
...
...
@@ -15,7 +15,7 @@ assert( merging_gap > 0 )
N
=
numel
(
pps
);
pps
_merged
=
[]
;
num
_merged
=
0
;
for
n
=
1
:
N
...
...
@@ -27,7 +27,8 @@ for n=1:N
if
norm
(
dist_vec
)
<
merging_gap
warning
(
'Direct sound path smaller than mering gap, skipped in merged paths'
);
else
pps_merged
(
end
)
=
propagation_path
;
num_merged
=
num_merged
+
1
;
pps_merged
(
num_merged
)
=
propagation_path
;
end
continue
end
...
...
@@ -36,21 +37,22 @@ for n=1:N
propagation_path_merged
.
propagation_anchors
=
propagation_path
.
propagation_anchors
(
1
);
k
=
0
;
% number of merged anchors
for
m
=
2
:
M
-
1
if
isa
(
propagation_path_merged
.
propagation_anchors
,
'struct'
)
from_anchor
=
propagation_path_merged
.
propagation_anchors
(
m
-
k
-
1
);
else
from_anchor
=
propagation_path_merged
.
propagation_anchors
{
m
-
k
-
1
};
end
dist_vec
=
propagation_path
.
propagation_anchors
{
m
}
.
interaction_point
(
1
:
3
)
...
-
from_anchor
.
interaction_point
(
1
:
3
);
m
=
1
;
for
m
=
1
:
M
-
1
cur_anchor
=
propagation_path_merged
.
propagation_anchors
{
m
-
k
};
next_anchor
=
propagation_path
.
propagation_anchors
{
m
+
1
};
dist_vec
=
next_anchor
.
interaction_point
(
1
:
3
)
-
cur_anchor
.
interaction_point
(
1
:
3
);
if
norm
(
dist_vec
)
<
merging_gap
propagation_path_merged
.
propagation_anchors
{
m
-
k
}
=
ita_propagation_merge_anchors
(
from_anchor
,
propagation_path
.
propagation_anchors
{
m
}
);
% Potentially override old merged anchor
propagation_path_merged
.
propagation_anchors
{
m
-
k
}
=
ita_propagation_merge_anchors
(
cur_anchor
,
next_anchor
);
k
=
k
+
1
;
else
propagation_path_merged
.
propagation_anchors
{
m
-
k
}
=
propagation_path
.
propagation
_anchor
s
{
m
}
;
propagation_path_merged
.
propagation_anchors
{
m
+
1
-
k
}
=
next
_anchor
;
end
end
end
num_merged
=
num_merged
+
1
;
pps_merged
(
num_merged
)
=
propagation_path_merged
;
end
...
...
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