shape.py
def rotation_matrix(axis, angle):
    """
    Euler-Rodrigues formula for rotation about an axis in 3D.
    """
    axis = np.asarray(axis)
    axis = axis / math.sqrt(np.dot(axis, axis))
    a = math.cos(angle / 2.0)
    b, c, d = -axis * math.sin(angle / 2.0)
    aa, bb, cc, dd = a * a, b * b, c * c, d * d
    bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d
    return np.array([[aa + bb - cc - dd, 2 * (bc + ad), 2 * (bd - ac)],
                     [2 * (bc - ad), aa + cc - bb - dd, 2 * (cd + ab)],
                     [2 * (bd + ac), 2 * (cd - ab), aa + dd - bb - cc]])

    Euler-Rodrigues formula for rotation about an axis in 3D.
    
Euler-Rodrigues formula for rotation about an axis in 3D.
Euler - Rodrigues formula for rotation about an axis in 3D .
def rotation_matrix(axis, angle):
    axis = np.asarray(axis)
    axis = axis / math.sqrt(np.dot(axis, axis))
    a = math.cos(angle / 2.0)
    b, c, d = -axis * math.sin(angle / 2.0)
    aa, bb, cc, dd = a * a, b * b, c * c, d * d
    bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d
    return np.array([[aa + bb - cc - dd, 2 * (bc + ad), 2 * (bd - ac)],
                     [2 * (bc - ad), aa + cc - bb - dd, 2 * (cd + ab)],
                     [2 * (bd + ac), 2 * (cd - ab), aa + dd - bb - cc]])
def rotation_matrix ( axis , angle ) : axis = np . asarray ( axis ) axis = axis / math . sqrt ( np . dot ( axis , axis ) ) a = math . cos ( angle / 2.0 ) b , c , d = - axis * math . sin ( angle / 2.0 ) aa , bb , cc , dd = a * a , b * b , c * c , d * d bc , ad , ac , ab , bd , cd = b * c , a * d , a * c , a * b , b * d , c * d return np . array ( [ [ aa + bb - cc - dd , 2 * ( bc + ad ) , 2 * ( bd - ac ) ] , [ 2 * ( bc - ad ) , aa + cc - bb - dd , 2 * ( cd + ab ) ] , [ 2 * ( bd + ac ) , 2 * ( cd - ab ) , aa + dd - bb - cc ] ] )
Euler-Rodrigues formula for rotation about an axis in 3D.
Euler - Rodrigues formula for rotation about an axis in 3D .
"""
    Euler-Rodrigues formula for rotation about an axis in 3D.
    """
axis
angle