def euler_angles(Q): w, (x, y, z) = Q phi = _atan2(2.*(w*x+y*z), 1.-2.*(x*x+y*y)) theta = _asin(2*(w*y-x*z)) psi = _atan2(2.*(w*z+x*y), 1.-2.*(y*y+z*z)) return phi, theta, psi
def asin(x): return _asin(x) if common._use_radians else _deg(_asin(x))
def critical(n1, n2): """Calculate critical angle in degrees.""" assert n1 > n2, "\nWarning: Critical angle is not defined, since n1 <= n2!" return _degrees(_asin(n2 / n1))