Exemple #1
0
def corner(n, u, t):
    if n == 0:
        return hv.Spline(([(np.nan, np.nan)], [1]))
    else:
        return quartet(corner(n - 1, u, t), side(n - 1, t), rot(side(n - 1,
                                                                     t)), u)
Exemple #2
0
def side(n, t):
    if n == 0:
        return hv.Spline(([(np.nan, np.nan)], [1]))
    else:
        return quartet(side(n - 1, t), side(n - 1, t), rot(t), t)
Exemple #3
0
def combine(obj):
    "Collapses overlays of Splines to allow transforms of compositions"
    if not isinstance(obj, hv.Overlay): return obj
    return hv.Spline((np.vstack([el.data[0] for el in obj.values()]),
                      np.hstack([el.data[1] for el in obj.values()])))
Exemple #4
0
def T(spline, transform):
    "Apply a transform to a spline or overlay of splines"
    spline = combine(spline)
    result = Path(spline.data[0], codes=spline.data[1]).transformed(transform)
    return hv.Spline((result.vertices, result.codes))
Exemple #5
0
        return quartet(corner(n - 1, u, t), side(n - 1, t), rot(side(n - 1,
                                                                     t)), u)


def squarelimit(n, u, t):
    return nonet(corner(n, u, t), side(n, t), rot(rot(rot(corner(n, u, t)))),
                 rot(side(n, t)), u, rot(rot(rot(side(n, t)))),
                 rot(corner(n, u, t)), rot(rot(side(n, t))),
                 rot(rot(corner(n, u, t))))


def rot(el):
    return T(el, rotT)


def rot45(el):
    return T(el, rot45T)


def flip(el):
    return T(el, flipT)


fish = hv.Spline((spline, [1, 4, 4, 4] * 34))  # Cubic splines
smallfish = flip(rot45(fish))
t = fish * smallfish * rot(rot(rot(smallfish)))
u = smallfish * rot(smallfish) * rot(rot(smallfish)) * rot(rot(rot(smallfish)))
v = squarelimit(3, u, t).opts(
    opts.Spline(width=1000, height=1000, xaxis=None, yaxis=None))
pn.Row(v).servable()