12 comments

[ 3.1 ms ] story [ 28.2 ms ] thread
A web app that uses Python to create Celtic knots and it's really fun!
Looks neat. Might be worth constraining the inputs. I got an error at 200x200:

  Uncaught PythonError: Traceback (most recent call last):
  File "<exec>", line 22, in resetKnot
  File "<exec>", line 473, in generateKnot
  File "/lib/python3.12/site-packages/PIL/Image.py", line 2941, in new
    return im._new(core.fill(mode, size, color))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MemoryError
I'm thinking this might have broader use than artistic appeal. From what I've heard, knot generation is a young but increasingly important topic in knot theory, since it can be used to generate data to train ML models on, and subsequently (hopefully) discover new algorithms for knot classification. See https://www.nature.com/articles/s41586-021-04086-x for example.
The linked article references George Bain’s book on Celtic knotwork construction methods, but his son Ian Bain actually found a much, much better method, and argues convincingly that this, not his father’s, was the method used by medieval Celtic illustrators. Ian’s method more easily produces consistent rope widths (when done by hand), and addresses the issue of how to soften these angular turns which ruin the rope effect and produce a robotic grid.

The book is out of print now but it looks like you can borrow it on archive.org: https://archive.org/details/celticknotwork0000bain/mode/2up

I really like how the author walks us through the generation process step-by-step. It makes it seem possible for me to build stuff like this too!!
This post makes me wonder - does anyone else think there is a need for a term to more strongly differentiate between procedural generation (like this knot-drawing program) and genAI? I feel it really diminishes the impact of the work of programmer-artists nowadays to say they make “computer-generated” art. Or maybe we already have such a term?
Dropping a thank you to the OP for sharing.

Really enjoyed how you traced your mental model through the journey of solving the problem.

Webapp doesn't work for me (current version Firefox):

  Uncaught TypeError: loading.showModal is not a function
    <anonymous> https://2earth.pyscriptapps.com/celtic-knot/  latest/:20
  latest:20:17
    <anonymous> https://2earth.pyscriptapps.com/celtic-knot/    latest/:20
and

  Uncaught (in promise) DOMException: IDBFactory.open: The operation is insecure
    <anonymous> index.js:65
    Xe index.js:63
    Ye sync.js:8
    engine pyodide.js:95
    get interpreters.js:36
    promise callback*get/< interpreters.js:34
    xn loader.js:66
    promise callback*xn loader.js:66
    Kn script-handler.js:91
    or custom.js:99
    define custom.js:266
    <anonymous> core.js:307
    promise callback\* core.js:182
core-Dwn9Kajy.js:1
Thanks, I'll look into it
You should check out Knot dice, which is a fun tactile way to make one.

www.blackoakgames.com/collections/knot-dice