TabletWeaving

Documentation for TabletWeaving.

Tablets

A tablet or card is a square piece of card stock.

It has a front and a back.

It has a hole on each of it's four corners.

When looking at the front of the card, the holes are labeled A, B, C, and D clockwise.

The edges of the card are numbered, with the edge from corner A to corner B numbered 1. The edge between B and C numbered 2, and so on around the card.

For weaving, one warp thread passes through each hole.

The four warp threads for a tablet pass from the warp beam, through the tablet, to the cloth beam. They can pass through the tablet from BackToFront or FrontToBack.

Which thread passes through which hole, and how the tablet is threaded, can not change once the loom is warped.

It's easier to think about how the stitches are formed if the tablets are facing (either back or front depending on threading) the weaver. For compactness though the cards are stacked so that the weaver is facing their edges. When stacked, each tablet can be oriented FrontToTheRight or FrontToTheLeft.

Which direction a tablet is facing when it is stacked can be changed during weaving.

For each new row, each tablet must be rotated, and its stacking may be flipped. These operations affect the locations of the labeled holes (and their warp threads) relative to the loom.

Tablet Structure

We represent each edge of a tablet by a TabletEdge and each hole by a TabletHole:

The functions next, previous, and opposite can be applied to a TabletHole or a TabletEdge to get the next, previous, or opposite one respectively.

TabletWeaving.nextFunction
next(::TabletHole)::TabletHole
next(::TabletEdge)::TabletEdge

Return the next hole or edge from the argument, clockwise around a tablet.

source
TabletWeaving.previousFunction
previous(::TabletHole)::TabletHole
previous(::TabletEdge)::TabletEdge

Return the previous hole or edge from the argument, counterclockwise around a tablet.

source
TabletWeaving.oppositeFunction
opposite(::TabletHole)::TabletHole
opposite(::TabletEdge)::TabletEdge

Return the opposite hole or edge from the argument.

source

Tablet Threading

How the warp threads pass through a tablet, the TabletThreading, can either be BackToFront or FrontToBack.

for BackToFront threading, warp threads pass from the warp beam through the tablet from back to front and then to the cloth beam.

For FrontToBack threading, Warp threads pass from the warp beam through the tablet from front to back and then to the cloth beam.

These threadings also have a concise textual representation. BackToFront can be represented by / or z. FrontToBack can be represented by \\ or s.

TabletWeaving.threading_for_charFunction
threading_for_char(::AbstractChar)

Given an 's' or a 'z', return an instance of the the corresponding TabletThreading.

There seems to be some confusion in the tablet weaving community about which is which. In this code base, 'z' corresponds to BackToFront threading.

source

Tablet Stacking

If the tablets are arranged with a flat side facing the weaver this would take too much space and also cause other inconveniences. Instead, tablets are arrahged so that their flat faces face each other. This forms a horizontal stack from one side of the loom to the other.

When stacked like this, a tablet is said to be stacked FrontToTheRight if it's front face faces towards the right side of the from the weaver's perspective. A tablet facing the opposite direction is said to be threaded FrontToTheLeft.

For brevity in textual representations, FrontToTheRight is represented with a right arrow and FrontToTheLeft with a left arrow.

Tablet

TabletWeaving.warp_colorFunction
warp_color(::Tablet, ::TabletHole)

Return the color of the warp thread that passes through the specified hole of the specified tablet.

source
TabletWeaving.top_edgeFunction
top_edge(::Tablet)::TabletEdge

Return the TabletEdge of the top edge of the tablet. This edge is easier to see on the loom than the shed edge. It is also unaffected by the tablet's stacking.

source

We use a Vector of Tablets to describe how the loom is set up for weaving. for convenience, we can add these vectors together for a wider pattern. We can also multiply them to repeat tablets.

Tablet Rotation

Prior to each new throw of the weft, the tablets are rotated to open a new shed.

In practice (the stacked arrangement), a card will be rotated forward or backward. Forward rotation moves the top corner of the card closest to the weaver away from the weaver towards the warp beam. Backward rotation moves the top corner furthest from the weaver toards the weaver.

Whether forward rotation turns the card in the ABCD or the DCBA direction depends on how the card is threaded and stacked.

TabletWeaving.rotationFunction
rotation(::Tablet, ::RotationDirection)

Return the change in the Tablet's accumulated_rotation if the specified `AbstractRotation is applied.

source
TabletWeaving.ABCDType

The ABCD rotation causes the A corner of the tablet to move to the location in space previously occupied by the B corner.

source
TabletWeaving.DCBAType

The DCBA rotation causes the A corner of the tablet to move to the location in space previously occupied by the D corner.

source
TabletWeaving.ClockwiseType

The Clockwise direction refers to how the tablet would move if its front or back face (depending on threading) were facing the weaver. Whether this results in ABCD or DCBA rotation depends on how the tablet is threaded.

source
TabletWeaving.CounterClockwiseType

The CounterClockwise direction refers to how the tablet would move if its front or back face (depending on threading) were facing the weaver. Whether the front or the back of the tablet is facing the weaver depends on whether the card is BackToFrontorFrontToBack` threaded.

source
TabletWeaving.ForwardType

The Forward rotation moves the top corner of the tablet closest to the weaver and the cloth beam to be the top corner farthest from the weaver.

source
TabletWeaving.BackwardType

The Backward rotation moves the top corner of the tablet closest to the weaver and the cloth beam to be the bottom corner closest to the weaver.

source

Weaving

To weave, the weaver first rotates the tablets according to some pattern. Rotating the tablets opens a new shed. The shuttle is then passed through the new shed to finish weaving that row.

TabletWeaving.rotate!Function
rotate!(::Tablet, ::RotationDirection)

Rotate the tablet by one position in the specified direction.

source
TabletWeaving.shot!Function
shot!(::Tablet)

Apply the current rotation to the tablet and return the colors of the warp threads passing over the top and bottom of the fabric, and the crossing direction (as a StitchSlant) when looking at the front/top face of the fabric. Note that the slant on the bottom face will be the other of the slant on the top surface since the fabrick is flipped to see the other face.

source

Stitch Slant

Rotation of a tablet introduces twist int o the four threads passing through that tablet. That twist is locked in by the next weft thread. The twist causes one thread to cross over each surface and two threads to pass through from front to back or back to front. The stitches that cross over the front or back surface of the woven fabric will appear slightly slanted. We need vocabulary to describe the directions of those slants.

TabletWeaving.SStitchType

SStitch describes how a woven stitch is slanted when it angles from the near right (for the corresponding weft) to tbe far left. An SStitch is formed when the rotation of a tablet passes the thread to the weaver's left.

source
TabletWeaving.ZStitchType

ZStitch describes how a woven stitch is slanted when it angles from the near left (for the corresponding weft) to tbe far right. A ZStitch is formed when the rotation of a tablet passes the thread to the weaver's right.

source

Describing a Pattern

How should we describe tablet motion during weaving?

After each throw, each tablet must be rotated forward or backward to make a new shed. In the simplest patterns, all tablets are rotated in the same direction. For more complicated patterns however, tablets move in different directions for each shed. How can we represent these rotations for ease of execution by the weaver?

There is one set of tablet motions for each throw of the shuttle. We should have a row number. The weaver must keep track of which row they're working.

There is motion for each tablet. The motion of a single tablet can be concisely described by unicode arrows (🡑, 🡓) or by the edge number of the tablet that is facing the shed or on top. The latter is less error prone since an incorrect starting position for a tablet will be detected.

The simplest representation is a Vector for the whole pattern. Each element would be a Vector of digits from 1 to 4 indicating the edge of the tablet that's currently "on top".

Designing a Pattern

Simple Patterns

TabletWeaving.f4b4_rotation_planFunction
f4b4_rotation_plan(row_count::Int)

Return a rotation plan function that weaves the specified number of rows. All tablets in the first four rows will be rotated forward. All tablets in the next four rows are rotated backward, Rotation direction continues to alternate every four rows until the end of the pattern.

source

Going from an Image to a Pattern

We have an array of the "image" we want to weave. How do we translate that into a set of tablets, their warping, and their motions?

How do we execute that "plan" to produce a stitch image to see how the pattern turned out.

For a two color pattern, we can warp each tablet with one color in holes A and C and the other in holes B and D. Whatever the previous stitch, the tablet can be rotated to either color. The slant of the stitch can't be controlled though.

TabletWeaving.tablets_for_imageFunction
tablets_for_image(image)

Return a Vector of the Tablets that could be used to weave the image, which should be a two dimensional array. If the tablets can't be determined then an error is thrown.

The first dimension of image counts rows of weft. The second dimension counts columns of warp, and therefore, tablets.

source

tablets_for_image does nothing about tablet threading, only colors.

The tablet weaving patterns I've seen all seem to have one threading on one side of the pattern and another threading on the other side, with the possible exception of the borders having different threading from the field.

We can introduce a function that sets one threading from the edge to the middle and switches to the other threading for the other half.

TabletWeaving.symetric_threading!Function
symetric_threading!(Vector{<:Tablet};
                    leftthreading::TabletThreading = BackToFront())

Set the threading of the tablets to be bilaterally symetric .

source
TabletWeaving.alternating_threading!Function
alternating_threading!(tablets::Vector{<:Tablet};
                       leftthreading::TabletThreading = BackToFront())

Set the threading of each tablet so that each tablet has the opposite threading from its two neighbors.

source
TabletWeaving.TabletWeavingPatternType
TabletWeavingPattern

TabletWeavingPattern represents a single tablet weaving project, from initial target image to tablets to pattern to images of the expected result.

source

Composition

We might want to combine a number of graphical elements in our weaving design. Some utilities are provided to support this.

safe_hcat and safe_vcat can be used to combine multiple images horizontally or vertically. These are just instances of (an instantiable subtype of) SwatchComposer.

TabletWeaving.SwatchComposerType
(::SwatchComposer)(align::SwatchAlignment,
                   padvalue, swatches)

Return a single two dimensional array composed by juxtaposing the swatches according to align. Swatches that are not compatible in size are padded with padvalue.

HorizontalComposer composes the swatches horizontally – along the length of the warp. safe_hcat is an alias for this composer.

VerticalComposer composes the swatches vertically – across the width of the warp. safe_vcat is an alias for this composer.

source
TabletWeaving.SwatchAlignmentType
(::SwatchAlignment)(::SwatchComposer, swatch::Array{Any, 2}, add,
                    padvalue)

Add padding to swatch so that its size will be compatible with those of other swatches when performing the SwatchComposer. add is the number of rows or columns to be added to swatch. The value of each element added in the padding is specified by padvalue.

source
TabletWeaving.AlignHeadsType
AlignHeads

An instantiable subtype of SwatchAlignment that aligns the left or top edges of graphical elements when safe_hcat or safe_vcat is used. Padding is adddeed after the swatctch as needed.

source
TabletWeaving.AlignCentersType
AlignCenters

An instantiable subtype of SwatchAlignment that aligns the centers of graphical elements when safe_hcat or safe_vcat is used. Padding is added both before and after the swatch as needed.

source
TabletWeaving.AlignTailsType
AlignTails

An instantiable subtype of SwatchAlignment that aligns the right or bottom edges of graphical elements when safe_hcat or safe_vcat is used. Padding is added before the swatch as needed.

source
TabletWeaving.insert_betweenFunction
insert_between(swatches, between)

Intersperse between among swatches.

swatches is a vector of 2 dimenswional arrays that will be part of a tablet weaving pattern. A new vector is returned with between inserted between each two adjacent arrays from swatches.

Suitable for adding spacing between letters or lines of text, but can also be used to add spacing between arbitrary graphical elements.

source

Text

A simple dot matrix font is provided so that we can include text in our designs.

TabletWeaving.FONT_5x7Constant
FONT_5x7

Contains 5 wide by 7 high dot matrix bitmap images of uppercase letters, digits and punctuation. Indexed by Char.

source

Everything Else

TabletWeaving.svg_stitchFunction
svg_stitch(stitch_width, stitch_length, stitch_diameter, slant::Char)

Generate the SVG for drawing a stitch.

stitch_width is the width of the stitch on the SVG X and weaving weft axis.

stitch_diameter is how wide the stitch is.

stitch_length is the length of the stitch in the SVG Y and warp axis.

slant is as returned by shot!.

source
TabletWeaving.count_warp_colorsFunction
count_warp_colors(t)

Return a Dict keyed by color, the values of which are the number of times that color is used as a warp thread in the Tablet or tablets t.

source
TabletWeaving.want_colorFunction
want_color(::Tablet, color)

Return a Vector containing named tuples (of new edge, AbstractRotation, and change in tablet rotation) describing the possible rotations that will provide the specified color.

source
TabletWeaving.tablet_weaveFunction
tablet_weave(tablets::Vector{<:Tablet}, rotation_plan)

Simulate the weaving of an item that is warped according to tablets and is woven according to rotation_plan.

rotation_plan is a function of three arguments:

  • a vector of the tablets;

  • the row number of the warp being formed;

  • the number of the tablet, counted from the weaver's left.

It should return a RotationDirection, or nothing if the row number is past the end of the pattern.

tablet_weave rotates the tablets according to the plan function, steping the row number until rotation_plan returns nothing.

tablet_weave returns several values:

  • an array of the stitch color and slant, from which an image of the top face of the result can be made;

  • the same, but for the bottom face of the result;

  • a vector with one element per weft row, each element of which is a vector with

one element per tablet, giving the rotation that was applied to that tablet and its new top edge after applying that rotation, as a tuple.

source
TabletWeaving.longer_dimension_counts_weftFunction
longer_dimension_counts_weft(image)

Return an image with the dimensions possibly permuted such that each increment in the first dimension counts a new row of the weft. The second dimension indexes the color of the visible warp thread for that row.

source

Index