Fractals are typically self-similar patterns, whereby self-similar means they are ‘the same from near as from far’. Fractals may be the same at every scale, or they may be nearly the same at different scales. The definition of fractal goes beyond self-similarity per se to exclude trivial self-similarity and include the idea of a detailed pattern repeating itself. As mathematical equations, fractals are usually nowhere differentiable, which means that they cannot be measured in traditional ways. (Source)
Often associated with fractals are L-Systems. Developed in 1968 by Aristid Lindenmayer, an L-system or Lindenmayer system is a parallel rewriting system, namely a variant of a formal grammar, most famously used to model the growth processes of plant development. An L-system consists of: an alphabet of symbols that can be used to make strings; a collection of production rules which expand each symbol into some larger string of symbols; an initial ‘axiom’ string from which to begin construction; and a mechanism for translating the generated strings into geometric structures. (Source)
The derivation strings of developing L-systems can be interpreted as a linear sequence of instructions to a ‘turtle’, which interprets the instructions as movement and geometry building actions. The historical term turtle interpretation comes from the early days of computer graphics, where a mechanical robot turtle (either real or simulated), capable of simple movement and carrying a pen, would respond to instructions such as ‘move forward’, ‘turn left’, ‘pen up’ and ‘pen down’. Each command modifies the turtle’s current position, orientation and pen position on the drawing surface. The cumulative product of commands creates the drawing (Source).
The Axiom and Production Rules are defined as follows:
- F = Move forward a step of length d
- f = Move forward a step of length d without drawing a line
- + = Turn left by angle b
- – = Turn left by angle b
- \ = roll left
- / = roll right
- ^ = pitch up
- & = pitch down
- | = turn around
To create fractals within Grasshopper, we can use either the HoopSnake or Rabbit plug-ins:
HoopSnake is a component that enables feedback loops within Grasshopper. It was initially developed by Yannis Chatzikonstantinou but is now open source. What it does in principle is to create a copy of the data it receives at its input upon user request and store it locally. This duplicate is made available through a standard Grasshopper parameter output. The input of the component includes some custom programming to escape Grasshopper’s recursive loop avoidance check.
The loop can be stopped either by the user or automatically by setting a termination condition to false. This way, an operation mode quite similar to a ‘while’ loop can be modelled in Grasshopper, without any coding. This method is beneficial primarily to the clarity of a definition since it enables the exposure of an iterative solution’s logic outside a scripting component.
HoopSnake has four inputs:
- S: Starting value.
- D* : Feedback value. This can be connected anywhere (including forward components).
- B* : Control value. Can also be connected anywhere and will look for Boolean values.
- T*: This is not used in this example, but it functions as a trigger input. If it’s value changes, the parent component will ‘take over’ the loop. Useful to create chains of HoopSnakes of recursive iteration.
To run HoopSnake, right-click on the HoopSnake component and select ‘Loop’. To reset, right-click on the HoopSnake component and select ‘reset all’.
Rabbit is developed by Morphocode and is a plug-in that simulates biological and physical processes. The plug-in provides an easy way to explore natural phenomena such as pattern formation, self-organisation, emergence, and non-linearity. It can also create 2D/3D Cellular automata and L-Systems. When generating an L-systems in Rabbit, there are two main components: L-System and Turtle.
The L-System component is based on a specified ‘Axiom’ and a set of production rules, where:
- A = Axiom – The first Word in the L-system. It is also called the ‘seed’ or ‘initiator’.
- PR = Production Rules – Used by the L-System to generate the Words in the L-system language.
- N = Number of generations.
- W = The last word derived by the L-system.
- L = List of words generated by the L-system – This list contains all words, starting by the axiom, ending with the last generated word (W).
- LS = The L-system object, based on the specified Axiom and Production Rules.
To visualise the L-System we need to use the Turtle component, where:
- S = Source String
- L = Length of the turtle’s step
- dL = Step scale length
- A = Default angle of the turtle used for rotation
- dA = Default angle scale
- O = Initial position and orientation of the turtle
- TS = Tube settings