def rotate_and_traslate(cur, alpha, v0):
    r"""Rotate and translate a curve."""
    if len(cur) > 2 or (type(cur[0][0]) in [list, tuple]):
        cur_list = cur[:]
        for i in range(len(cur_list)):
            curi = cur_list[i]
            curi = rotate_and_traslate(curi, alpha, v0)
            cur_list[i] = curi
        return cur_list
    else:
        x0, y0 = cur
        rot = np.matrix([[cos(alpha), -sin(alpha)], [sin(alpha), cos(alpha)]])
        xn = []; yn = []
        for i in range(len(x0)):
            v = np.matrix([[x0[i]], [y0[i]]])

            vi = np.dot(rot, v)
            xn += [float(vi[0][0])+v0[0]]; yn += [float(vi[1][0])+v0[1]]

        return xn, yn
def rotate_and_traslate ( cur , alpha , v0 ) : if len ( cur ) > 2 or ( type ( cur [ 0 ] [ 0 ] ) in [ list , tuple ] ) : cur_list = cur [ : ] for i in range ( len ( cur_list ) ) : curi = cur_list [ i ] curi = rotate_and_traslate ( curi , alpha , v0 ) cur_list [ i ] = curi return cur_list else : x0 , y0 = cur rot = np . matrix ( [ [ cos ( alpha ) , - sin ( alpha ) ] , [ sin ( alpha ) , cos ( alpha ) ] ] ) xn = [ ] ; yn = [ ] for i in range ( len ( x0 ) ) : v = np . matrix ( [ [ x0 [ i ] ] , [ y0 [ i ] ] ] ) vi = np . dot ( rot , v ) xn += [ float ( vi [ 0 ] [ 0 ] ) + v0 [ 0 ] ] ; yn += [ float ( vi [ 1 ] [ 0 ] ) + v0 [ 1 ] ] return xn , yn
r"""Rotate and translate a curve.