# HG changeset patch # User samer # Date 1328292487 0 # Node ID ffd7efa3e5c0ad9cae829e40d4170384c76bbaf5 # Parent cfdca07197b6f67eca78b5cedd2d4c155aedc6d3 Added reverse map from information space to triangle; moved info coors to transmat window. diff -r cfdca07197b6 -r ffd7efa3e5c0 mt_calibrate.m --- a/mt_calibrate.m Thu Feb 02 03:12:22 2012 +0000 +++ b/mt_calibrate.m Fri Feb 03 18:08:07 2012 +0000 @@ -12,11 +12,13 @@ P = Sys.refpoints; fprintf('\nCalibrating for triangle vertices at:\n'); disp(P); p0 = P(:,1); - Sys.map = info_map_fn(p0,inv(P(:,2:3)-repmat(p0,1,2))); + [Sys.map, Sys.revmap] = info_map_fn(p0,P(:,2:3)-repmat(p0,1,2)); end -function f=info_map_fn(p0,M) - f=@(p)clip_tri(M*(p-p0)); +function [f,g]=info_map_fn(p0,M) + iM=inv(M); + f=@(p)clip_tri(iM*(p-p0)); + g=@(p)p0+M*p; end function x=clip_tri(x) diff -r cfdca07197b6 -r ffd7efa3e5c0 mt_get_transmat_at.m --- a/mt_get_transmat_at.m Thu Feb 02 03:12:22 2012 +0000 +++ b/mt_get_transmat_at.m Fri Feb 03 18:08:07 2012 +0000 @@ -12,9 +12,10 @@ % The selected transition matrix will be shown using mt_show_transmat, % and it's information coordinates printed in the title of the main scatter plot. -function [T,I]=mt_get_transmat_at(Sys,Id,K,X,Y) +function [T,P,I]=mt_get_transmat_at(Sys,Id,K,X,Y) + logK=log(K); normpos = Sys.map([X;Y])'; - target = normpos *log(K); + target = normpos*logK; tmats = Sys.transmats{K}; info = Sys.info{K}; L = size(info,1); @@ -30,8 +31,9 @@ I = info(J,:); %Mask=2*int16(Mask); Mask(J)=1; %set(Sys.hScat{K},'CDATA',Mask); % scatc(info,Mask,16); rotate3d on; - figure(Sys.fig); title(sprintf('info: %.2f, %.2f, %.2f',I(1),I(2),I(3))); + %figure(Sys.fig); title(sprintf('info: %.2f, %.2f, %.2f',I(1),I(2),I(3))); %figure(50); title(sprintf('pos: %.2f, %.2f',normpos(1), normpos(2))); %fprintf('normpos: %.2f, %.2f',normpos(1), normpos(2)); - mt_show_transmat(Id,T); + mt_show_transmat(Id,T,I); + if nargin>1, P=Sys.revmap(I(1:2)'/logK); end end diff -r cfdca07197b6 -r ffd7efa3e5c0 mt_revmap.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mt_revmap.m Fri Feb 03 18:08:07 2012 +0000 @@ -0,0 +1,4 @@ +% mt_revmap - Map from information space back to triangle space +% +% mt_revmap :: mt_system, real, real -> [[2]]. +function p=mt_revmap(sys,x,y), p=sys.revmap([x;y]); end diff -r cfdca07197b6 -r ffd7efa3e5c0 mt_show_transmat.m --- a/mt_show_transmat.m Thu Feb 02 03:12:22 2012 +0000 +++ b/mt_show_transmat.m Fri Feb 03 18:08:07 2012 +0000 @@ -5,7 +5,11 @@ % [[K,K]] ~'transition matrix' % -> action void. -function mt_show_transmat(Id,T) +function mt_show_transmat(Id,T,I) figure(Id); imagesc(T,[0,1]); axis xy; + if nargin>2 + title(sprintf('H=%.2f, R=%.2f, PI=%.2f',I(1),I(2),I(3))); + end +end