Introduction
Advanced fractals and recursive systems represent a fascinating intersection of mathematics, art, and computer science. These systems create intricate and infinitely complex patterns that can be both visually stunning and mathematically significant. In this blog, we will delve into the world of advanced fractals and recursive systems, exploring their concepts, applications, and implementation in various platforms such as Processing, p5.js, and TouchDesigner.
TL;DR: Advanced fractals and recursive systems use mathematical principles to create complex patterns. They have applications in various fields and can be implemented using tools like Processing, p5.js, and TouchDesigner.
Understanding Advanced Fractals and Recursive Systems
Advanced fractals are patterns that exhibit self-similarity and can be generated using recursive algorithms. Recursive systems are processes that repeat themselves in a self-similar way, often leading to fractal-like structures.
What are Advanced Fractals and Recursive Systems?
Advanced fractals are geometric shapes that can be split into parts, each of which is a reduced-scale copy of the whole. Recursive systems, on the other hand, use functions that call themselves to create these fractal structures. This self-replication process can produce highly detailed and intricate patterns from simple rules.
Expanding System Functionality
Recursive systems and fractals can expand the functionality of a system by enabling the creation of complex and detailed structures from simple rules. This can be particularly useful in computer graphics, procedural generation, and other fields where detailed and complex patterns are needed.
For example, using genetic operators such as crossover and mutation, advanced fractals can be employed to optimize creative processes in generative art. By tweaking the parameters of the recursive functions, artists can explore a wide variety of patterns and forms, leading to unique and innovative artworks.
TL;DR: Advanced fractals are self-similar patterns generated using recursive systems, which can expand system functionality and optimize creative processes.
Implementing Advanced Fractals and Recursive Systems in Processing
Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. It is particularly well-suited for creating and visualizing fractals and recursive systems.
Creating Advanced Fractals in Processing
To create advanced fractals in Processing, you can use functions such as pushMatrix(), popMatrix(), translate(), and rotate(). These functions allow you to manipulate the drawing context and create complex, self-similar patterns.
Using pushMatrix() and popMatrix() Functions
The pushMatrix() function saves the current transformation matrix, and popMatrix() restores it. These functions are essential for creating recursive patterns because they allow you to isolate transformations and ensure that each recursive call starts with the same initial conditions.
void drawFractal(float x, float y, float len, int depth) {
if (depth == 0) return;
line(x, y, x + len, y);
pushMatrix();
translate(x + len, y);
rotate(PI / 4);
drawFractal(0, 0, len * 0.67, depth - 1);
popMatrix();
pushMatrix();
translate(x + len, y);
rotate(-PI / 4);
drawFractal(0, 0, len * 0.67, depth - 1);
popMatrix();
}
Example: Generative Artwork in Processing
Inspired by the minimalist geometric style of Manfred Mohr, you can create a generative artwork by manipulating the parameters of a recursive function to produce various patterns. For example, a recursive tree-like structure can be created using the above code, which produces a fractal tree by recursively drawing branches.
TL;DR: In Processing, functions like pushMatrix() and popMatrix() enable the creation of complex recursive patterns, such as fractal trees.
Implementing Advanced Fractals and Recursive Systems in p5.js
p5.js is a JavaScript library that makes coding accessible for artists, designers, and beginners. It is excellent for creating web-based fractal and recursive systems.
Creating Advanced Fractals in p5.js
In p5.js, you can use variables and constants to implement recursive systems, such as L-systems, which are a type of formal grammar used to model the growth processes of plant development.
Using Variables and Constants in L-Systems
An L-system consists of an alphabet of symbols that can be used to make strings, a set of production rules that 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.
let axiom = "F";
let sentence = axiom;
let len = 100;
let angle;
let rules = [];
rules[0] = {
a: "F",
b: "FF+[+F-F-F]-[-F+F+F]"
};
function generate() {
let nextSentence = "";
for (let i = 0; i < sentence.length; i++) {
let current = sentence.charAt(i);
let found = false;
for (let j = 0; j < rules.length; j++) {
if (current == rules[j].a) {
found = true;
nextSentence += rules[j].b;
break;
}
}
if (!found) {
nextSentence += current;
}
}
sentence = nextSentence;
len *= 0.5;
turtle();
}
function turtle() {
background(255);
resetMatrix();
translate(width / 2, height);
stroke(0, 100);
for (let i = 0; i < sentence.length; i++) {
let current = sentence.charAt(i);
if (current == "F") {
line(0, 0, 0, -len);
translate(0, -len);
} else if (current == "+") {
rotate(angle);
} else if (current == "-") {
rotate(-angle);
} else if (current == "[") {
push();
} else if (current == "]") {
pop();
}
}
}
Example: Creating a Dragon Curve in p5.js
The Dragon Curve is a fractal that can be generated using an L-system. By defining the rules and the axiom, you can generate the Dragon Curve and visualize it using p5.js.
TL;DR: In p5.js, L-systems can be used to create complex fractal patterns like the Dragon Curve by defining production rules and translating them into geometric structures.
Implementing Advanced Fractals and Recursive Systems in TouchDesigner
TouchDesigner is a visual development platform that provides tools for creating stunning real-time projects and rich user experiences. It supports advanced fractals and recursive systems through its node-based interface and scripting capabilities.
Creating Advanced Fractals in TouchDesigner
In TouchDesigner, you can use the Bullet Solver and other nodes to create and manipulate recursive systems. This allows for the creation of complex, interactive fractal patterns.
Using the Bullet Solver for Recursive Systems
The Bullet Solver in TouchDesigner is used for real-time physics simulations. It can be adapted to create recursive patterns by controlling the parameters and interactions between objects.
bullet_solver = op('bulletsolver1')
bullet_solver.par.active = True
bullet_solver.par.timestep = 1/60
bullet_solver.par.gravity = (0, -9.8, 0)
Example: Creating an Audio-Reactive Flythrough Tunnel
By combining the Bullet Solver with audio-reactive particles, you can create a dynamic flythrough tunnel that responds to sound. This involves setting up the Bullet Solver, defining the particles’ behavior, and linking the system to audio input.
TL;DR: TouchDesigner’s Bullet Solver and other nodes enable the creation of complex, interactive fractal patterns, such as audio-reactive flythrough tunnels.
Advanced fractals and recursive systems offer endless possibilities for creativity and exploration. By leveraging tools like Processing, p5.js, and TouchDesigner, artists and technologists can create intricate and dynamic patterns that push the boundaries of art and mathematics.
TL;DR: Advanced fractals and recursive systems, implemented using Processing, p5.js, and TouchDesigner, enable the creation of complex, dynamic patterns that blend art and mathematics.
FAQ
What are advanced fractals?
- Advanced fractals are geometric shapes that exhibit self-similarity and can be generated using recursive algorithms.
What are recursive systems?
- Recursive systems are processes that repeat themselves in a self-similar way, often leading to fractal-like structures.
How can Processing be used to create fractals?
- Processing can create fractals using functions like pushMatrix(), popMatrix(), translate(), and rotate() to manipulate the drawing context.
What is an L-system in p5.js?
- An L-system is a type of formal grammar used to model the growth processes of plant development and create fractal patterns.
How does TouchDesigner support fractal creation?
- TouchDesigner uses nodes like the Bullet Solver and scripting to create and manipulate recursive systems and fractal patterns.
What are some applications of advanced fractals?
- Applications include computer graphics, procedural generation, art, and optimization of creative processes.
Can fractals be interactive?
- Yes, especially when using platforms like TouchDesigner that support real-time interaction and audio-reactive elements.
What is the Bullet Solver in TouchDesigner?
- The Bullet Solver is a node used for real-time physics simulations, which can be adapted to create recursive patterns.
What are the benefits of using recursive systems in art?
- Recursive systems enable the creation of highly detailed and complex patterns from simple rules, enhancing creativity and innovation.
How do you generate a Dragon Curve in p5.js?
- By defining L-system rules and translating them into geometric structures, you can generate and visualize the Dragon Curve.
Bibliography
- Processing Reference
- p5.js Reference
- TouchDesigner Documentation
- L-Systems and Fractals
- Manfred Mohr’s Generative Art
- Bullet Solver in TouchDesigner

2 responses to “Creating Complex Patterns: Advanced Fractals and Recursive Systems with Processing, p5.js, and TouchDesigner”
[…] Creating Complex Patterns: Advanced Fractals and Recursive Systems with Processing, p5.js, and Touch… […]
LikeLike
[…] Creating Complex Patterns: Advanced Fractals and Recursive Systems with Processing, p5.js, and Touch… […]
LikeLike