Converting the rotation matrix to Euler angle