Dynamic Lattice Manipulation

new experimental feature of the SRG kernel

[1]:
from hypertiling import HyperbolicTiling
from hypertiling.graphics.svg import *
from hypertiling.graphics.plot import plot_geodesic
import matplotlib.pyplot as plt

def myplot(tiling):
    ax = plot_geodesic(T, ec="0.6", lw=0.7, zorder=3)
    for idx, poly in T.polygons.items():
        if idx in T.exposed:
            col = "#ad153d"
        else:
            col = "k"
        z = poly.centerP()
        t = ax.text(np.real(z), np.imag(z), str(idx), c=col, ha="center", va="center", fontsize=17*(1-0.7*np.abs(z)), zorder=1)
        t.set_bbox(dict(facecolor='w', edgecolor="none", alpha=0.5))

General usage

Construct and draw a small lattice to start with. Cells with red labels are called “exposed”, they represent the outmost layer and their neigbours are incomplete as they only know about their parents, but not about siblings

[2]:
T = HyperbolicTiling(7, 3, 2, kernel="SRG", center="vertex")
[3]:
myplot(T)
../_images/examples_dynamic-manipulation_6_0.png

Upon execution of “add_layer”, the vacant spaced around all exposed cells is filled with new polygons

[4]:
T.add_layer()
[5]:
myplot(T)
../_images/examples_dynamic-manipulation_9_0.png

We can also remove cells, using a list of corresponding indices

[6]:
T.remove_cells([7,8,9,10,11,12,13,14])
T.remove_cells([1])
T.remove_cells(range(27,36))
T.remove_cells(range(37,42))
[7]:
myplot(T)
../_images/examples_dynamic-manipulation_12_0.png

Let us again add a layer to reconnect the pieces

[8]:
T.add_layer([0,36])
[9]:
myplot(T)
../_images/examples_dynamic-manipulation_15_0.png

Filters

The add_layer function allows to use filters, which can specify the domain in which we want to construct new cells

[45]:
# this filter allows construct cells only in a certain range of complex angles
def my_angular_filter(z):
    return True if (45 < np.angle(z, deg=True) < 180) else False
[46]:
T = HyperbolicTiling(5,4, 2, kernel="SRG")
[47]:
myplot(T)
../_images/examples_dynamic-manipulation_19_0.png

And this is how it works

[48]:
T.add_layer(filter = my_angular_filter)
T.add_layer(filter = my_angular_filter)
T.add_layer(filter = my_angular_filter)
[49]:
myplot(T)
../_images/examples_dynamic-manipulation_22_0.png
[ ]: