Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
344e8168
Commit
344e8168
authored
Nov 23, 2017
by
Jan-Gerrit Richter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce spatial function in itaHRTF
parent
884d1890
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
applications/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
...ations/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
+39
-0
No files found.
applications/Binaural-HRTF/HRTF_class/@itaHRTF/reduce_spatial.m
View file @
344e8168
...
...
@@ -14,5 +14,44 @@ function [ cThis ] = reduce_spatial( this, newCoordinates, varargin )
% Author: Jan-Gerrit Richter <jri@akustik.rwth-aachen.de>
% Version: 2017-11-23
oldCoords
=
this
.
getEar
(
'L'
)
.
channelCoordinates
;
% if the desired sampling has more points, its probably unfeasable with
% findnearest search. Abort
if
oldCoords
.
nPoints
<
newCoordinates
.
nPoints
error
(
'There are more points in the wanted sampling than are available. You probably want the interp function'
);
end
% the new coords should have the same radius as the old ones to reduce
% errors
newCoordinates
.
r
=
mean
(
oldCoords
.
r
);
oldCoords
=
oldCoords
.
build_search_database
;
newIndex
=
oldCoords
.
findnearest
(
newCoordinates
);
% calculate all distances from the wanted points to the found points
pointDistances
=
getVectorLength
(
newCoordinates
,
oldCoords
.
n
(
newIndex
));
% calculate the distance between two neighboring points of the new sampling
newSamplingDistance
=
getVectorLength
(
newCoordinates
.
n
(
1
),
newCoordinates
.
n
(
2
));
% the maximum of the found points should always be smaller
if
max
(
pointDistances
)
>
newSamplingDistance
error
(
'The found points are further apart than the sampling allows. Something is wrong'
)
end
cThis
=
this
.
direction
(
newIndex
);
end
function
length
=
getVectorLength
(
pointsA
,
pointsB
)
pointsA
.
r
=
pointsB
.
r
;
vector
=
pointsA
-
pointsB
;
length
=
sqrt
(
vector
.
x
.^
2
+
vector
.
y
.^
2
+
vector
.
z
.^
2
);
end
\ No newline at end of file
Write
Preview
Markdown
is supported
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