# Kernel Details

The kernel features a number of methods that can be used to construct the tiling: First we define a method to create the vertices of a fundamental hyperbolic (p,q) polygon. It calculates the radius, constructs the vertices using trigonometric functions, and then transforms the vertices to Weierstrass coordinates.

hypertiling.kernel.DUN07.Dunham._create_fundamental_polygon(self)

This function constructs the vertices of the fundamental hyperbolic {p,q} polygon.

Now we implement a recursive function that implements the Dunham tiling algorithm. It replicates a polygonal pattern by iterating over vertices and polygons, updating transformations and exposures, and recursively calling itself to draw the pattern at different layers of recursion.

hypertiling.kernel.DUN07.Dunham._replicate_motif(self, poly, initialTran, layer, exposure)

This is the central recursion step for the Dunham tiling algorithm.

This function draws a polygon pattern, then if the current layer is less than the desired layers self.n, it determines which vertex to start at based on the exposure. It then iterates over the vertices and polygons, updating the transformations and exposures accordingly, and recursively calls itself.

Parameters:
• poly (object) – The polygonal object to be replicated.

• initialTran (DunhamTransformation) – The initial transformation to be applied.

• layer (int) – The current layer of the recursion.

• exposure (int) – The current exposure level.

Notes

The function first draws a polygon pattern using initialTran. If layer is less than self.n, it determines which vertex to start at based on whether exposure is equal to self.min_exp. It then iterates over the vertices and polygons, updating transformations and exposures, and recursively calls itself.

The method _replicate is the driver routine for the Dunham tiling algorithm. It takes a polygonal object as a parameter and initiates the drawing of the second layer, starting the recursion. If the number of desired layers is 1, it returns immediately. Otherwise, it iterates over each vertex of the polygon and, for each vertex, iterates over a certain number of polygons. For each polygon, it determines the exposure level, replicates the motif, and modifies the transformation.

hypertiling.kernel.DUN07.Dunham._replicate(self, poly)

This is the top-level driver routine for the Dunham tiling algorithm.

This function initiates the drawing of the second layer and starts the recursion.

Parameters:

poly (object) – The polygonal object to be replicated.

Notes

This function first creates an identity transformation and uses it to draw a fundamental polygon pattern. If the number of desired layers (self.n) is 1, the function returns immediately. Otherwise, it iterates over each vertex of the polygon (self.p), and for each vertex, it further iterates over a certain number of polygons (self.q - 2). For each polygon, it determines the exposure level, replicates the motif, and modifies the transformation.

What is left is the function which initiates the construction:

hypertiling.kernel.DUN07.Dunham._generate(self)

This function generates the tiling starting from a fundamental polygon