H6X9H


Algorithm

The algorithm for generating a figure consists of 2 phases. In the first phase a recipe of directions will be made. In the second phase the recipe is applied for constructing the figure.

The algorithm can best be illustrated by using an rational number, being the ratio of a numerator N and a denominator D. For the moment, N is assumed to be odd, and D even; and also, the value of D is less than N. Furthermore, without loss of generality, both numbers are relatively prime.

The recipe is a sequence of directions, named { a0, a1, ... , aN-1 }. An element in the sequence is either R (right) or L (left). It is computed by comparing multiples of D with multiples of N. The rule for ak is as follows:
    the direction of element 
ak with index k equals R, if  k*D mod(2*N) < N, and
    it equals L, if  k*D mod(2*N) >= N .
For example, D=2, N=5 yields recipe RRRLL . After N directions a full cycle has been made due to D being even. The length of the recipe is N. It consists always of (N+1)/2 directions R, and (N-1)/2 directions L.

In the second phase a plane is used, that is virtually tiled with equilateral triangles. The middle of a certain triangle is chosen as the start point of the figure, as follows:

Direction


One of the 3 neighbouring triangles is selected for fixing the orientation. From the start point a line is drawn to the middle of one of the 2 other triangles. The choice for the 2 neighbours is determined by the recipe at phase 1. Relative to the current orientation we turn to the right if the direction in the recipe equals R, and otherwise we turn to the left. The drawn line is used as new orientation for drawing the next line. After processing the whole recipe the last line will point to 4 o' clock, see below:

RRRLL

Applying the above procedure another 5 times brings us back at the start point! This concludes the construction of the figure. For the above example, the complete figure looks like :

N=5 D=2

The following remarks can be made about the above algorithm.

  1. Suppose D and N have a common divisor J, such that D/J is still even. Applying the algorithm leads to the same figure, only the figure's path has been visited J times.
  2. If D is odd, then the recipe has the same number of directions to the right as to the left. The orientation at the begin of the recipe and at the end of the recipe will then be equal. So, repeating the recipe will never yield a closed figure.
  3. The H6X9H figures can be considered as a visualisation of a pair of integers. For educational purpose, it is interesting to use the figures for investigating how pairs relate to each other. Some figures based on big numbers resemble other figures, based on smaller numbers, with some pattern superimposed.