Manual: Fractals

Submitted by David on Wed, 12/21/2016 - 13:46

The fractal system in Touch Embroidery are lsystem fractals. It uses a set of turtle graphic commands. Then, in turn, turns these patterns into sewable items.

The commands are as follows:

  • F
    • Forward.
  • +
    •  Turn clockwise
  • -
    • Turn counter-clockwise
  • G
    • Forward, without drawing.
  • /
    • Divide by set factor
  • *
    • Multiply by set factor
  • [
    • Push pen stack.
  • ]
    • Pop pen stack.

Only the first three F, +, - are very useful. While the others can be used, they often involve cutting the thread and thus can result in many layers. Any other letter character is ignored but can be used for rewriting rules in the fractal.

Like many things in Touch Embroidery these fractals are written by string of values in the form <command-letter><command>

These define the fractals and have a few noteworthy attributes.

  • a
    • Defines the axiom. This is the starting seed of the fractal. This is the value of the zeroth iteration.
  • t
    • Defines a rule, there can be any number of rules and they will all be applied equally during the iteration.
  • T
    •  Defines a finalization rule. Sometimes fractal can be made to propagate properly but need to have a final rewriting step before they are used. These rules are not carried through during the iterations but only applied to the final product. For example Quadratic Gosper is "aRtL=LL-R-R+L+L-R-RL+R+LLR-L+R+LL+R-LR-R-L+L+RR-tR=+LL-R-R+L+LR+L-RR-L-R+LRR-L-RL+L+R-R-L+L+RRTL=FTR=F" Both the R and L are ignored in the turtle, the finalization step here TL=F and TR=F change these into forwards.
  • n<degrees> <variation> <left-bias> <right-bias>
    • The number of degrees each turn command applies to.
  • N<value> <variation> <left-bias> <right-bias
    • Degrees of the turn are said to equal 360/value, so N3 = 120, N6 = 60, N10 = 36.
    • If all N values are omitted it is assumed that the turns will be 90°
    • The variation is the amount in degrees this value will vary by to a random amount. So N4,5 means that turns will be 90° ± 5°
    • The left and right bias values allow turns to to the right to be more than turns to the left. So N4,0,0,5 means that turns to the left are 90° but turns to the right are 95°
  • d <distance> <factor>
    • This sets the distance as well as allowing setting the factor. "d5" for example means each forward travels a distance of 5 pixels (typically amounts to 0.5mm), the factor is the amount each successive '/' or '*' command causes to change the distance. For example the fractal H-Curve is "aXtX=*[+FX][-FX]n90d500 0.70710678118" where d is initially set to 500 and each time the '*' command is seen multiplies that distance by 0.70710678118 which is the square root of 2 divided by 2.
  • i <times>
    • iterate <times> times to begin.
  • c <integer colorvalue>
    • Sets the color to that given value.
  • p <x> <y>
    • Sets the position. 

Here, a, t, and N are the important commands, the rest likely should be ignored. They are mostly just used internally to fully and properly describe a given fractal.

So let up suppose you wanted to add a fractal Dekking's Church, you would go to the fractal widget, in settings and hit add. Then add the fractal as a path:

"a-WXYZtF= tW=FW+F-ZFW-F+XtZ=++F- -Y-F+X++F- -Y-F+XtY=++F- -Y+F-ZtX=FW+F-Z"

Which is to say:

  • Axiom: -WXYZ
  • Rule F=" "
  • Rule W="FW+F-ZFW-F+X"
  • Rule Z="++F- -Y-F+X++F- -Y-F+X"
  • Rule Y="++F- -Y+F-Z"
  • Rule X="FW+F-Z"
    • Since no N command turns are taken to be 90°.