knots documentation#
source tacaswell/knots
Based on Celtic Art: The Methods of Construction [1], which covers how to create Celtic-style knot work this code automates the initial steps for basic knots.
Method#
Very briefly, the method is to:
construct a single line that is the path of the knot
expand to a ribbon around the center line
remove the center line
interleave the crossings
elaboration and decoration
Using this code you will be able to generate up to stage 3 that can be printed and traced.
To make this concrete, the initial step is to generate the path of the knot, shown here including the control points used for path and indicating the unit cell that was mirrored to make the complete knot.
(Source code, png, svg, pdf)
Dropping the construction marks and showing the center line gives
(Source code, png, svg, pdf)
At this stage, this is ready to be printed to begin the manual process of interleaving the crossings. Pick any crossing and decide which direction will be “over”. You then move either direction along the ribbon alternating over/under until you return to the starting point.
(Source code, png, svg, pdf)
Usage#
A minimal script to generate and display a knot is:
import numpy as np
from knots.display import generate_stage3, show_with_guide
from knots.path import Knot, Pt, path_from_pts
import mpl_gui
def gen():
return path_from_pts(
[
(Pt(0, 0.5), 0),
(Pt(-0.5, 0.0), np.rad2deg(np.pi / 2)),
(Pt(0, -0.50), np.rad2deg(np.pi)),
(Pt(0.5, 0.0), np.rad2deg(-np.pi / 2)),
],
scale=0.5,
closed=True,
)
k = Knot(gen())
fig_guide = show_with_guide(k, display=False)
fig_stage3 = generate_stage3(k, display=False, width=15)
mpl_gui.display(fig_guide, fig_stage3)
# fig_stage3.savefig('/tmp/my_knot.pdf')
which can be run via
pixi run scratch
Edit to something that brings you joy!
Development and Contributions#
This project is typed and has ruff formatting and linting applied.
There are no tests other than looking at the demo section of the docs.
The docs can be rebuilt via
pixi run build_docs
Contributions are welcome, particularly additional knots in demos.py (shown
in Demos).
Dependencies#
Matplotlib
contourpy (which Matplotlib also depends on, but used directly)
mpl-gui (technically optional)
George Bain#
To quote the website of his collection
George Bain (1881-1968) was a Scottish illustrator, watercolourist, designer and art teacher whose vision and advocacy of a living, creative Celtic craft provides an important and influential contribution to continued interest in Celtic and Insular art.
Footnotes