I’ve been playing with python and made a knot generator that produces svg’s of flat turks head knots. Its hosted on my website at:
Hopefully usefull to some of you,
Regards,
Christian
I’ve been playing with python and made a knot generator that produces svg’s of flat turks head knots. Its hosted on my website at:
Hopefully usefull to some of you,
Regards,
Christian
So cool! I’ve added it to the post I started at Knot Calculators and Planners which seems to no longer be stickied to the top of the Knot-Related Computing.
What does the petal driver setting do?
Interesting that you’ve used Python. I’m in the process of vibe-coding a Javascript knot calculator (because I am not interested in learning Javascript except that it’s the “native” language for client side processing).
Thank you!
I chose Python because I’m much more comfortable with it than any other language. Streamlit makes it easy to put a usable interface around it without having to build the whole front end in JavaScript.
The modelling in this generator is mathematical. In Turk’s head mode I’m using:
r = R + a * cos((q / p) * t)
In flower mode the radius is built from two separate oscillations:
r = R + a1 * cos(t) + a2 * cos(k * t)
So the petal driver affects that second oscillation. In practical terms, it influences how often the decorative petal-like features repeat around the design. The a1 term controls more of the broad overall shape, while a2 controls how strong the secondary flower or rosette detail becomes.
I like it a lot! Under mode “turks” I could not figure out what the parameter “weave offset” does.
I understand that you probably intended this for Turk’s Heads that can be tied with a single strand. Thus, you need the number of leads and the number of bights to have greatest common divisor one. This works for a 3L X 7B but it tells me that a 4L X 7B cannot be done. (See sample below, because it can be done.)
I would also urge you to consider expanding to the case where the greatest common divisor is r and it takes r different cords (which can be displayed with different colors). See below a 4L X 6B example with 2 cords and a 3L X 6B example with 3 cords. Sometimes your program seems to give the one cord in such a multiple example (say 3L X 6B). Other times it just says it cannot be done (say 4L X 6B).
It might be too much to try to determine the greatest common divisor in your program. Perhaps you can add it as a separate parameter in the list of inputs. This parameter would be set to one by default, but if the user was unhappy with what was produced (which should be one strand), the user could change the parameter to the correct greatest common divisor so that the program could draw the other strands in different colors. With all of this, there should be no “illegal” pL X qB but you might want to not allow the input to be one for either the number of leads or the number of bights.
Thanks for the feedback
In the current version, “weave offset” shifts where the repeating over/under pattern starts along the ordered crossing sequence. So with a pattern like OU, changing the offset simply flips which encounter is treated as over first.
You are also right about the lead/bight issue. A 4L × 7B Turk’s head is valid, since gcd(4, 7) = 1, so if my tool rejects it that is a limitation in my current implementation rather than knot theory. At the moment the “turks” mode is really a single parametric turk-style curve with over/under assigned afterward, not yet a full lead/bight Turk’s head solver.
The next improvement I want to make is to compute gcd (leads, bights) explicitly and support multi-component knots properly, so examples like 4L × 6B and 3L × 6B can be displayed as 2- and 3-cord knots in different colours. That should make the Turk’s head side of the tool much more mathematically correct.
Hopefully I’ll have it updated in the next few weeks.
Thank you for what you do! I enjoy tying mats, coasters and trivets. Your creativity and talent will, no doubt broaden my horizons.
I used your Flat Knot Generator to make a
3L 13B turk’s head trivet with red, white and blue paracord.
For me, the 13B represents the 13 original colonies of the USA. Just in time for the 250th anniversary.
Thank you
That’s ace, really pleased they are being used. I’ve a way to go yet before they are 100%. I’m currently trying to figure out true toroidal Turks heads.
Christian
Christian,
Let me repeat my earlier advice that you do not try to compute the greatest common divisor of the number of bights and leads in your Python program. You need access to a computer algebra system to do factoring of integers. I do not think it is unreasonable to expect this gcd as input.
If you insist on doing everything in your program, the simplest way, since you have a somewhat limited range of numbers, is as follows: Type in a 2-by-2 integer array of all possible greatest common divisors, and do a lookup based upon the input number of bights and leads. You might generate this array with a computer algebra system if you have access to one.
Dennis