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
4e2e5e74
Commit
4e2e5e74
authored
Jul 30, 2019
by
Dipl.-Ing. Jonas Stienen
Browse files
Reworking point outside wedge and point facing main/opposite side functions
parent
e0d7c2d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
applications/SoundFieldSimulation/Diffraction/@itaFiniteWedge/point_outside_wedge.m
View file @
4e2e5e74
function
b
=
point_outside_wedge
(
obj
,
point
)
% Returns true if the point is outside the solid structure of
%
point_outside_wedge
Returns true if the point is outside the solid structure of
% the finite wedge
%
% Example: b = w.point_outside_wedge( point )
%
dim
=
size
(
point
);
if
dim
(
2
)
~=
3
if
dim
(
1
)
~=
3
error
(
'Point(s) must be of dimension 3'
)
end
point
=
point
'
;
dim
=
size
(
point
);
end
assert
(
all
(
size
(
point
)
==
size
(
obj
.
location
)
)
)
assert
(
abs
(
norm
(
obj
.
main_face_normal
)
-
1
)
<
obj
.
set_get_geo_eps
)
assert
(
abs
(
norm
(
obj
.
opposite_face_normal
)
-
1
)
<
obj
.
set_get_geo_eps
)
% Use Hesse normal form
d1
=
dot
(
point
-
obj
.
location
,
obj
.
main_face_normal
);
d2
=
dot
(
point
-
obj
.
location
,
obj
.
opposite_face_normal
);
dist_from_main_face
=
sum
(
(
point
-
obj
.
location
)
.*
obj
.
main_face_normal
,
2
);
dist_from_opposite_face
=
sum
(
(
point
-
obj
.
location
)
.*
obj
.
opposite_face_normal
,
2
);
b
=
zeros
(
dim
(
1
),
1
);
mask
=
(
dist_from_main_face
<
-
obj
.
set_get_geo_eps
)
&
(
dist_from_opposite_face
<
-
obj
.
set_get_geo_eps
);
b
(
~
mask
)
=
true
;
% Bad error propagation for face normals ... use a very soft resolution
% for a point beeing inside or outside a wedge.
b
=
any
(
[
d1
d2
]
>
(
-
2
)
*
obj
.
set_get_geo_eps
);
end
applications/SoundFieldSimulation/Diffraction/@itaInfiniteWedge/point_facing_main_side.m
View file @
4e2e5e74
function
res
=
point_facing_main_side
(
obj
,
point
)
function
res
_t
=
point_facing_main_side
(
obj
,
point
)
% Returns string including the face normal of source
% facing wedge side
% output: 'n1' -> source is facing main face of wedge
% 'n2' -> source is facing opposite face of wedge
%% Assertions
dim
=
size
(
point
);
if
dim
(
2
)
~=
3
if
dim
(
1
)
~=
3
error
(
'Position vectors must be of dimension 3!'
);
end
%point = point';
dim
=
size
(
point
);
end
if
any
(
~
obj
.
point_outside_wedge
(
point
)
)
if
~
obj
.
point_outside_wedge
(
point
)
error
(
'Source position(s) must be outside the wedge!'
);
end
...
...
@@ -44,8 +35,10 @@ y_i2 = dot( point - obj.location, e_y2, 2 );
temp2
=
atan2
(
y_i2
,
x_i2
);
temp2
(
temp2
<
0
)
=
temp2
(
temp2
<
0
)
+
2
*
pi
;
res
=
true
(
dim
(
1
),
1
);
res
(
temp2
<
temp1
)
=
false
;
res_t
=
true
(
3
,
1
);
res_t
(
temp2
<
temp1
)
=
false
;
res
=
any
(
res_t
);
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