function [vert_r,v,d] = rotation(vert, vt, dt)

% find eigenvectors and adjust directions

[v,d] = eig2(vert,0.3);

% spherical coord of eigenvectors of current surface

[th_e,phi_e,r_e] = cart2sph(v(1,:),v(2,:),v(3,:));

% spherical coord of eigenvectors of template

[th_t,phi_t,r_t] = cart2sph(vt(1,:),vt(2,:),vt(3,:));

% rotation

vert = Rz(vert,(th_t(3)-th_e(3)));
vert = Rx(vert,(phi_t(3)-phi_e(3)));
vert = Ry(vert,(phi_t(2)-phi_e(2)));

% find eigenvectors and adjust directions after rotation

[v,d] = eig2(vert,0.3);

vert_r = vert;
