This is a Java Swing applet that lets you design Celtic knots. The construction method used is the "triple-grid" method discovered by Aidan Meehan in 1974. Most likely, it was actually rediscovered by him, because it seems very reasonable that this comprehensible and well-structured method was the method actually used by the original artists in ancient times. Previous authors have had vague, informal or even incorrect ideas on this, and Aidan Meehan was first to publish a practical and complete method for the analysis and construction of these designs. He is also a practising artist in the craft.
The basis for the pattern is a grid of square cells, forming what is called the primary grid. Entire grid cells can be blocked out from the pattern, or edges of the cells can be blocked to prevent lines from crossing them. In addition to that, there is a secondary grid of the same size, but offset one half cell horizontally and vertically. Edges of that secondary grid may also have blocks that prevent lines from crossing them. A primary edge and a secondary edge which intersect may not both have a block on them simultaneously. That rule is enforced in the interactive editor you see here, so you cannot create an illegal grid layout with this program. The diagonally oriented tertiary grid which Meehan describes is not drawn. It is helpful when you draw designs by hand, but here it would only clutter up the display.
Edges are blocked by clicking on them (or near them) once. A second click will remove the blocker. Clicking in a cell but not on an edge will place a blocker on that entire cell. Primary edge blockers will be drawn in red, and secondary edge blockers in green. Grid lines without an active blocker will be gray, solid for the primary grid and dotted for the secondary grid. If you try to place a blocker where it would create an illegal layout, nothing happens.
If you have a slow computer, the interactive display may be a bit sluggish. In that case, you can uncheck the box "Fancy graphics" in the top right corner. The knot line will look a lot more crude, but it will be redrawn faster. You can switch instantly between the nice and the less nice graphics whenever you want.
The top and the bottom of the design are considered to be connected, so that the edges at the top have the same properties as the corresponding edges on the bottom, and likewise for the far left and far right. If you do not want this wrap-around behaviour, add an extra row and/or column of empty cells to your layout.
The user interface should be pretty obvious. Just play around with it. Every edge is clickable, and the design is updated interactively as you place blockers, so you should be able get the general idea pretty quickly. If you want to change the grid size, change the "Width" and "Height" values and press "Reset pane".
The checkbox "Show grid" makes it possible to switch the grid display on and off at any time. Without the grid, you get a clean view of the knot all by itself, but the interactive editing is also disabled, because there is nothing to help you see what you are doing.
This program makes the mechanics of knot design simple and quick, but a nice knot design takes practice and talent to make, so you might want to start off by looking at examples, copying them and trying a few variations before crafting your own original designs. The underlying grid is quite obvious for most traditional and modern designs, once you know how to look at it. If you want to read a good book, I can really recommend Aidan Meehan's "The Treasury of Celtic Knots", Thames & Hudson 2005. It's a paperback edition, very reasonably priced.
The automatic algorithm used in this program is pretty simple. Once I formalised the edge blockers and stored them in a properly designed data structure (a few arrays), the problem could be looked at from the perspective of a single primary cell at a time, actually even one quarter of a square cell. There are not that many local combinations for the knot line. The endless variations possible are due to the large number of cells in a design, but the number of legal cell appearances is actually quite small, and the problem lent itself very well to a computer-based solution.Stefan Gustavson (email@example.com), September 2005