function deform110
%%%%%%%%%%%%%%%%
%clean up.
%%%%%%%%%%%%%%%%

clear;

%%%%%%%%%%%%%%%%
% select what kind of transform, 010 or 110
%%%%%%%%%%%%%%%%
%S = {'010'};
%[Selection,ok] = listdlg('ListString',S,'SelectionMode','single');
Selection = 1;
%%%%%%%%%%%%%%%%
%set what is the result of press or stratch
%%%%%%%%%%%%%%%%

inputCell = inputdlg({'Please input the end of transform'}, 'Input',1,{'0.6'});
delta = str2num(inputCell{1});
%%%%%%%%%%%%%%%%
%set original points
%%%%%%%%%%%%%%%%

origin = [  
            [-1,0,0];[0,1,0];
            [0,1,2];[1,0,2];
            [0,1,2];[-1,0,2];
            [-1,0,0];[-1,0,2];
            [0,-1,2];[1,0,2];
            [0,-1,2];[0,-1,0];
            [-1,0,0]
        ];
origin0 = [ 
            [1,0,0];[1,0,2];
            [1,0,0];[0,-1,0];
            [1,0,0];[0,1,0];
        ];
%%%%%%%%%%%%%%%%
%transformation matrix in the direction of <010>
%%%%%%%%%%%%%%%%

transform010 =[  [ 0,delta, 0 ]; [ sqrt( 1 / delta ), 0 , 0];[ 0, 0, sqrt( 1 / delta )] ];

%%%%%%%%%%%%%%%%
% transformation matrix in the direction of <110>
%%%%%%%%%%%%%%%%

transform110 = [ [ ( 1 / delta + delta ) / 2, ( -1 / delta + delta ) / 2, 0 ];
                 [ ( -1 / delta + delta ) / 2, ( 1 / delta + delta ) / 2, 0 ];
                 [0,0,1]
             ];

%%%%%%%%%%%%%%%%
% do transform
%%%%%%%%%%%%%%%%

if( 1 == Selection  )
	result = origin * transform010;
	result0 = origin0 * transform010;
else 
	result = origin * transform110;
end;

%%%%%%%%%%%%%%%
% draw picture
%%%%%%%%%%%%%%%

x = result(:,1);
y = result(:,2);
z = result(:,3);
line(x, y, z, 'color','black','LineWidth', 2);
x0 = result0(:,1);
y0 = result0(:,2);
z0 = result0(:,3);
line(x0, y0,z0,'color','black','LineWidth',1,'LineStyle','-.');
grid off;
axis equal;
%xlabel('110');
%ylabel('-110');
%zlabel('001');
