test_ita_coordinates.m 1.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
function test_ita_coordinates()

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved. 
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. 
% </ITA-Toolbox>


a = ita_generate('noise',1,44100,15);
a = ita_split(a,[1 1 1 1]);
a.channelCoordinates = itaCoordinates([1 5 9; 2 6 10; 3 7 11; 4 8 12],'cart');
%a.channelCoordinates = build_search_database(a.channelCoordinates);

[ind, dist] = findnearest(a.channelCoordinates,[2 2 2; 3 3 3],'cart',1); %Check matlab search (few elements)
if ~ind == [2; 3] %#ok<BDSCA>
    error('findnearest@itaCoordinates does not work');
end

[ind, dist] = findnearest([a.channelCoordinates a.channelCoordinates a.channelCoordinates],[2 2 2; 3 3 3],'cart',1); % Check mex-search (lots of elements)



coords = a.channelCoordinates;
tmp = coords.makeSph;
coords_new = tmp.makeCart;
coords_new.cart - coords.cart


tmp = coords.makePol;
coords_new = tmp.makeCart;
coords_new.cart - coords.cart

coords = coords.makeSph;
tmp = coords.makePol;
coords_new = tmp.makeSph;
coords_new.sph - coords.sph

end