I have been researching my family tartan, Drummond of Megginch, and coming up with a program to generate tartans. I was inspired by an American university computer science course problem.
I wanted a program that give a threadcount would produce an image of that tartan. One of the first issues is that Tartan is a woven textile. The simplest weave that you create is a plain weave:
This is controlled by a weaving iterator which has a pattern like this:
['-X', # Plain weave
The X marks a spot where the weft thread is on top, starting the repeat pattern from the bottom left of the page.
Weft threads run across the page (red) and warp threads are vertical (blue). If you double up the threads in a plain weave you get a basket weave:
The control pattern is :
['--XX', # Basket weave
However tartan is woven with a Twill pattern which gives rise to distinctive diagonal lines in the material. There are many twill weaving patterns but this one is described as 2 x 2:
The control pattern is now:
['-XX-', # 2/2 twill
The iterator can create much more complicated weaving patterns but that is all that is required for Tartan.