function [p,t] = shift(filename, shift_distance)

% SHIFT shifts the center of the initial mesh saved in FILENAME 
% to the new position specified by SHIFT_DISTANCE[1:3].

% Usage: shift('plate.mat', shift_distance)
%        shift('plate', shift_distance)
% where, position is an array of the ORDER (1,3) 
% e.g. [0 0 3] 


%Load the data.
load(filename);

shift_distance = shift_distance';
if((shift_distance(1,1) == inf) | (shift_distance(2,1) == inf) | (shift_distance(3,1) == inf))
    error('The new location of the mesh is at infinity.. take a smaller value to view it!');
else
    % Shifts the mesh to the new loaction given by SHIFT_DISTANCE.
    q = repmat(shift_distance(:,1),1,length(p))
    clear shift_distance
    p = p + q;
end
   
% Save the shifted mesh in FILENAME and view.
save (filename);
viewer (filename)

