Mercurial > hg > trimatlab
diff mt_calibrate.m @ 3:ffd7efa3e5c0
Added reverse map from information space to triangle; moved info coors to transmat window.
author | samer |
---|---|
date | Fri, 03 Feb 2012 18:08:07 +0000 |
parents | cfdca07197b6 |
children |
line wrap: on
line diff
--- 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)