Create New Stitches - Guy-Dentelle-Neupre/DiBL GitHub Wiki
The project logo illustrates how templates create diagrams from tiles. Each tile depicts one stitch. Each template has a "pile" of tiles. The application uses the text files of pair traversal patterns to put a proper set of tiles together.
To proof the concept, the tiles are created manually for a limited set of stitches.
*: detailed instructions are written for InkScape users, other SVG editors might have similar functionality.
Each cross and twist consists of three objects: two lines and a circle between them. The circle creates a gap in the line that lies in the background. These three objects are grouped. The groups give logical folding opportunities in the XML tree view, it might become a technical requirement in the future.
To adjust the lines you can use the tool "edit path by nodes (F2)". To move a dot to a new intersection select it with "edit path by nodes (F2)" but move it with "Select and transform objects (F1)". "Snap to cusp nodes" is useful to to make ends meet, otherwise snapping is contra-productive: hold down the shift key while dragging to temporarily disable snapping.
Stitches are annotated with the type of stitch, for example tcptc
for "twist cross pin twist cross" and with a tuple,
for example (1,1,0,0,-1,-1,0,0). together that makes "tcptc (1,1,0,0,-1,-1,0,0)"
You can set the annotation with the XML-editor:
add or change the attribute inkscape:label
, the annotation will appear in the tree.
- custom: Flanders
- Pair traversal patterns (Delivered with the download and also available here)
- diamond style tiles with short tuples.
- brick style tiles with long tuples
- diagonal patterns (flipping, rotating and color coded tiles are buggy)
- interleaved patterns (currently only composed with color coded tiles)
The stitches are designed in grey pair diagrams. As shown here on the right, these diagrams are divided into shapes per stitches. The nodes of the shapes provide snapping points for the thread versions of the stitches. The shapes also reveal the dots that create the gaps in the threads that go behind other threads.
The screenshot on the right zooms in on a single stitch: A color coded version and a thread version.
The background for a color coded stitch provides snapping points for the start points and end point of the pairs. The labels of stitches for color coded diagrams are prefixed with a "-".
The thread diagrams are drawn outside the box. This gives a better pleasing result than keeping the stitch boundaries at the tile boundaries. The grid provides snapping points for the end points of the threads: outside the background for the (usually twisted) incoming threads, inside the background for outgoing threads. The background reveals the dots that create the gaps in the threads that go behind other threads.
Stitches for diagonal patterns are designed in a separate SVG file, shown below and copy-pasted into the templates. For thread diagrams currently less stitches are available than for color coded diagrams.
Note that the stitches are annotated with long tuples, for example: (1,1,0,0,-1,-1,0,0) used to be (1,1,0,-1,-1,0)
- copy the new stitches without their background (don't clone)
- right-click on the pile and enter the group
- paste the new stitches
- make sure snap to cusp nodes is switched on
- move the stitches exactly in place
- Save the new template and run the generator with just the new stitch. Some old stitches remain unchanged? You might have made a typo in the annotations. None of the the stitches changed? Maybe you put the new stitches in a subgroup of the "pile", ungroup the subgroup.
For the interleaved patterns, the "limbs" of stitches can choose from eight positions in stead of six. That increases the number of required tiles exponentially. Creating the stitches manually proofed to be quite error prone. So let us try to generate them.
Thoughts on generating tiled stitches for thread diagrams are explored [DrawStitches]
Generating tiles for tc, tct and tctc are quite simple: draw two lines starting at grid nodes a1-a5 and ending at nodes a5-a1, the black star provides snapping points for the control points of the bezier curves. (fig A)
For Torchon grounds like tcptc it becomes more complicated, the lines should go around the pin. On way would be to just move the existing control point slightly beyond the pin (fig B). The individual tiles may look nice but it causes sharp bends at the edges of the tiles. It looks better to add a node in the middle of the line and move it beyond the pin. When adding the node, the original control points will move towards the ends of the curve. Move them back to the original position (fig C). The additional node sits on a circle around the pin on a line through the pin perpendicular to the line through the endpoints (fig D).
The pragmatic approach to generate the stitches with the classes DiagonalColorCodedTile and InterleavedColorCodedTile is sketched below, you can examine the control points with the specified coordinates with the svg variant in an appropriate editor. The algorithm has some sloppy results for torchon stitches: threads along the wrong side of the pin, threads going through the pin respectively too much crossings. All examples here.
First verify how the new versions look like.
- open an empty svg file with a plain text editor
- paste the generated HTML code just before "
</g></svg>
" at the end of the document. - save, close, reopen with InkScape
- select all objects
- menu: object - rows and columns... - button: arrange
- undo to get everything on the generated position
- copy
- open the template with InkScape
- right click the the group with the stitches to enter it
- remove the old versions
- menu: edit - select all
- unselect the grey background square (shift click)
- note that the number of selected objects in the status line now becomes one less
- delete the remaining selection
- paste the generated stitches into the cleared group