def _angle_between_quats(x, y):
 x0 = np.sqrt(np.maximum((((1.0 - (x[..., 0] ** 2)) - (x[..., 1] ** 2)) - (x[..., 2] ** 2)), 0.0))
 y0 = np.sqrt(np.maximum((((1.0 - (y[..., 0] ** 2)) - (y[..., 1] ** 2)) - (y[..., 2] ** 2)), 0.0))
 z0 = np.maximum(np.minimum(((y0 * x0) + (x * y).sum(axis=(-1))), 1.0), (-1))
 return (2 * np.arccos(z0))

def _angle_between_quats ( x , y ) : x0 = np . sqrt ( np . maximum ( ( ( ( 1.0 - ( x [ ... , 0 ] ** 2 ) ) - ( x [ ... , 1 ] ** 2 ) ) - ( x [ ... , 2 ] ** 2 ) ) , 0.0 ) ) y0 = np . sqrt ( np . maximum ( ( ( ( 1.0 - ( y [ ... , 0 ] ** 2 ) ) - ( y [ ... , 1 ] ** 2 ) ) - ( y [ ... , 2 ] ** 2 ) ) , 0.0 ) ) z0 = np . maximum ( np . minimum ( ( ( y0 * x0 ) + ( x * y ) . sum ( axis = ( - 1 ) ) ) , 1.0 ) , ( - 1 ) ) return ( 2 * np . arccos ( z0 ) )
compute the ang between two quaternions w/3-element representations .