Author Topic: Turk's Head Design Tool  (Read 19087 times)

clsn

  • Jr. Member
  • **
  • Posts: 20
Turk's Head Design Tool
« on: November 25, 2012, 12:48:59 AM »
Hi, new here...

I've been tinkering with building a web page for designing some "non-standard" Turk's Head knots.  Sort of inspired by Patrick Ducey's 24-bight mat with 11-lead sides (http://www.khww.net/articles.php?cat_id=6), I wanted to be able to make other knots that didn't follow the usual TH pattern of having all the bights ("pivots") at the same level.  The result is still very rough-edged, but I've been in the "finding someone who cares" stage of this project long enough that I want to show it around.

The page is at http://web.meson.org/crafts/TH/TH.html.  It uses Javascript to give you sort of a "live" graph-paper to plot your pivot-points on, and you can tell when a knot is one-strand tyable when all the lines turn the same color after you add a point.  There are verbose directions on the page, anyway.

There's another program, also mentioned there, that does a little more in-depth understanding of the knots, and which can generate some nice tying diagrams (sometimes), but that's not in Javascript and not embedded in the page.  If my server for it is running, you can access it with the button on the page; see the directions.  It also isn't perfect, especially when it comes to crossings for multistrand knots, and it knows nothing about any crossing pattern that isn't strictly over-under.

Anyway; please take a look and let me know what you think.

~mark

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #1 on: November 30, 2012, 02:32:24 AM »
I know you're out there...

Anyway, I've been working more on the other program, the one not on the web page.  See, the problem with working things like Pat's big mat is that then it's tricky to work out the slack just right.  So I've made my program capable of outputting circular diagrams.  They may not be perfect; I've not tried working with them yet (or any circular diagram) but they can help some.

So to tease, here are some pictures of Pat's mat and a 30-bight one I've found (but not yet made; it may not be good) projected circularly, etc. (sorry for small images; there's an upload limit).

struktor

  • Sr. Member
  • *****
  • Posts: 345
Re: Turk's Head Design Tool
« Reply #2 on: November 30, 2012, 11:42:24 AM »

kd8eeh

  • Exp. Member
  • ****
  • Posts: 159
Re: Turk's Head Design Tool
« Reply #3 on: December 01, 2012, 04:30:12 AM »
I am trying to learn programming, and also trying to teach several of my more mathy friends about knots, and i think knowing how this works would help me on both accounts.  I speak (to some extent) java and python, and was wondering if you could post the source code somewhere, so i could try to make sense of it, and use it as a baseline to make other similar programs.  Thanks:)

struktor

  • Sr. Member
  • *****
  • Posts: 345
Re: Turk's Head Design Tool
« Reply #4 on: December 01, 2012, 09:33:18 AM »
Example 1

Bights =30 ,  Leads =21 ,  Strands=?

We know that:
Strands = GCD (Bights, Leads) ;



Euclidean algorithm (for the calculation of GCD):

                      Bights           Leads   
             
                       30                   21 
  (30-21)=         9                 21
                         9                 12                =(21-9)
                         9                   3                =(12-9)
  (9-3)=             6                   3
  (6-3)=             3                   3
                  Bights  =  Leads   =  Strands  =  3

Answer:  Strands = 3
 





Greatest common divisor (GCD), also known as the greatest common factor (GCF).

To learn Euclid's algorithm:
http://www.youtube.com/watch?v=2HsIpFAXvKk
How to find the greatest common factor of two numbers.
Excel Level: Beginning. Math Level: Middle School - College.


« Last Edit: December 01, 2012, 10:43:55 AM by struktor »

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #5 on: December 02, 2012, 01:52:12 AM »
@kd8eeh: You're right, the code really should be public.  The two programs share a repository, though, which is kind of messy, and they developed with an embarrassing history sometimes.  So I made a new repository with just the Python code (which is the one you don't have access to anyway: the JS code is obviously on the web page), and cherry-picked key commits from the history.  You can find it on github at https://github.com/clsn/THexplorer (It wasn't called anything but knots.py until now, but there needed to be some name).  I'll do future work on knots.py there.  You'll need to get SVGdraw.py from http://opikanoba.org/res/python/SVGdraw/ to generate the SVG files.

Meanwhile, the only other person to write back about the tools is having trouble getting the web page to work.  Is it working for you folks out there?  In a sense that's the more interesting, since programs to draw diagrams are already out there.  But I haven't seen the "live graph-paper" approach in other places.

kd8eeh

  • Exp. Member
  • ****
  • Posts: 159
Re: Turk's Head Design Tool
« Reply #6 on: December 04, 2012, 04:01:04 AM »
I've been getting assorted error messages, some for incorrectly formatting my input and some for the server being accessible.  I hope this helps.

Also, thank you for the source code.  I don't speak python great, so I am looking it over with my friend who speaks python better, but does not know knots well.  Thanks!:)

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #7 on: December 06, 2012, 03:42:32 AM »
Yeah, the server wasn't always running, and I wonder what on earth I was thinking making it a server in the first place and not a simple CGI program.  It works differently now, so it should be a little more stable.

You're best off clicking in the graph paper and letting the page format the input; it should be okay then.

How is your experience with the "live graph paper" part, though?

kd8eeh

  • Exp. Member
  • ****
  • Posts: 159
Re: Turk's Head Design Tool
« Reply #8 on: December 06, 2012, 04:01:20 AM »
The live graph paper works fine, although it is a bit sensitive sometimes, particularly with the endpoints.  It will connect those kind of chaotically.  Overall, for what the library gives you to work with, it works fine.

I haven't been able to completely figure out your code yet, but when i do i will try to give you some suggestions on an actual programming context.  One thing i would like it to be able to handle would be to make knots that loop backwards and continue forward.  I have had no success with this through trial and error, but i have yet to see if the program can actually handle it.

There are some glitches where the graph paper is connecting some points that shouldn't be connected, i think due to me trying to make it put a pivot on the end, in an effort to make it actually take the strand to the end.

Hopefully this helps.

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #9 on: December 06, 2012, 04:25:04 AM »
I hope when you say "connecting some points that shouldn't be connected" you mean things like showing a line to a non-active spot, and not drawing lines that aren't along the graph grid.  That really shouldn't happen.  I've noticed the first problem happening from time to time, though.  Hitting "Recalc" fixes it, though it messes up your colors.

I don't really know what you mean by "knots that loop backwards and continue forward."  It may be that my programs simply can't deal with them, since they are designed for knots that are determined solely by their pivot-points and drawing the grid-lines between them.  If you have something where the cord changes direction (apart from up and down at pivots) I think you may be beyond the capabilities of what I've got.  Same with "take the strand to the end": the strands in general should go around and join themselves in rings, with no ends.

The basic idea behind both programs, really, is placing the pivot-points on the grid and drawing all the lines between any pair of pivots on the same grid-line, and that's all.  Maybe there needs to be something smarter for what you mean.

kd8eeh

  • Exp. Member
  • ****
  • Posts: 159
Re: Turk's Head Design Tool
« Reply #10 on: December 06, 2012, 04:45:07 AM »
Yes, i do mean the first one.

As far as the second comment, that makes this program make a whole lot more sense.  I didn't really assume that;  I just figured that it would make the sinnet work.  I don't think i read the instructions very clearly, and it's no help that i don't actually use a quark board to tie knots.

As far as looping around and coming back, here is a sample of what i mean
[(0,0),(2,6),(4,8),(6,6),(8,0),(10,6),(12,8),(14,6),(16,0),(18,6),(20,8),(22,6),(24,0),(26,6),(28,8),(30,6),(32,0)]

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #11 on: December 07, 2012, 06:37:00 AM »
I've added wording on the page to try to give that nutshell description that you said helped.  My instructions can be long and complicated; I can't really expect that most people will read them.  Also, you can now ask for your diagram in circular format.

I see what you mean now about "knots that loop backward."  Yeah, that's not really well-modeled by my software.  I define a knot as a set of pivot-points; all other information is derived from that.  To get something like what you're doing (with more points, that is) you need to have other information like what order you have to go through them in, or just how the direction changes at each one.  It may also be that the graph-paper modeling isn't well-suited to it in the first place.

kd8eeh

  • Exp. Member
  • ****
  • Posts: 159
Re: Turk's Head Design Tool
« Reply #12 on: December 08, 2012, 02:40:07 AM »
Perhaps it isn't, although i would still like to be able to map out star style turks heads.  I will try to find a way to improve the code to handle these better, as these loops can make some fantastic turks head designs.

clsn

  • Jr. Member
  • **
  • Posts: 20
Re: Turk's Head Design Tool
« Reply #13 on: January 27, 2013, 07:00:42 PM »
I've kludged in another feature to the page, for looking for "multi-level" THs.  The idea is along the line of some of the examples on the page already: you have a "bottom" level of pivots all across, and then some distance up you might have half the "upper" pivots, with the rest some level farther up than that.  Or n/3 and then 2n/3 higher up, or even n/2, then n/4, then n/4 higher still.  It's the "layers" feature in the python program.

Look for it at the bottom of the page: fill in your parameters and cross your fingers.  There isn't really any error-checking, so failures just fail.

Useful?

 

anything