%
% function [warped_pts] = polytransformorder2(frommarker, tomarker, frompts)
%
%
% Dr. A. I. Hanna  (2005)
function [warped_pts] = polytransformorder2(frommarker, tomarker, frompts)
T = cp2tform([tomarker(:,1), tomarker(:,2)], [frommarker(:,1), frommarker(:,2)], 'polynomial', 3);

u = double(frompts(:,1));
v = double(frompts(:,2));
%warped_pts = [ones(length(u),1)  u  v  u.*v  u.^2  v.^2]*T.tdata;
warped_pts = [ones(length(u),1) u  v  u.*v  u.^2  v.^2  v.*u.^2  u.*v.^2  u.^3  v.^3] * T.tdata;

return;