toEuler and toQuaternion functions