## 3. Constructs

### 3.1. Tile

The atomic construct of a Kufic pattern is the `tile`. A tile can be filled or unfilled. The most important thing in square Kufic is that there a balance of filled and unfilled tiles. More on this later.

A tile is a lot like a bit in computer science. For convenience, tiles will be stored as bits in unsigned integers. 8-bit and 16-bit integers will mostly be used, with 32-bit integers maybe being used in the future for larger constructs.

### 3.2. Pair

Two tiles form what is known as a `pair`. Kufic patterns are 2-dimensional, so pairs can be horizontal or vertical.

Four tiles in a 2x2 matrix are known as a `quad`. Quads are the primary building blocks for generating Kufic patterns.

Every possible quad can be represented as a 4-bit number. The bit order goes left to right, top to down. Bits 1 and 2 on the top row, bits 3 and 4 on the bottom row. Using hexadecimal, the patterns can be identified as single-character values 0-f.

A quad has four sides that are labelled as cardinal directions north, south, east, west, which correspond to top, down, right, left. Cardinal directions are used to address pairs in a quad. For example, the north (n) pair refers to the top half of the quad, and the east (e) pair refers to the right side of the quad. Intercardinal directions are used to address individual tiles in the quad. For example, the southwest (sw) tile is used to refer to tile in the bottom lefthand corner (bit position 3), and the northeast tile (ne) is used to get the top righthand tile (bit position 2).

### 3.4. Square

Quads then form in a 2x2 configuration to form a `square`. Quads are labelled left-to-right top down A, B, C, D. In addition to these main quads, there are also quads in between the quads, referred to as AC, AB, CD, BD, and ABCD. Their label tells which quads they are made out of.

A square can be represented in C in 2 bytes or a 16-bit integer. The first byte holds A (lower nibble) and B (upper nibble). The second byte holds C (lower nibble) and D (upper nibble).

### 3.5. Block

4 Squares form in a 2x2 configuration to form a `block`.

prev | home | next