function q=Euler2Quaternion(theta,w);

ERR=10^-4;
if abs(norm(w)-1)<ERR
 q=[sin(theta/2)*w;cos(theta/2)];
 if q(4)<0
  q=-q;
 end;
else
 q=[];
 fprintf('Error Euler2Quaternion: w is not unitary \n');
end;