- Options
Quadratic Snowflake
This Quadratic Snowflake is an L-System Fractal. As such it's not very remarkable or famous mathematically, but I think it still looks quite pretty. Just like the Board or the Crystal.
It is generated by the L-System Algorithm with the following settings:
const quadraticSnowflake: Ruleset = {
color: "#80b8f9",
minIterations: 1,
maxIterations: 7,
axiom: "FF+FF+FF+FF",
replace: {
F: "F+F-F-F+F",
},
angle: 90,
initLength: (sizes) => Math.min(sizes.width, sizes.height) / 2.5,
initTranslation: (sizes, initialLength) => [
sizes.width / 2 - initialLength,
sizes.height / 2 + initialLength,
],
divideFactor: 3,
};
This fractal, by its nature as an L-System, is related to all the other L-System Fractals. A few you can check out: Crystal, Fern 3, and the Lévy Curve.
The alphabet to instructions set used to draw this fractal are the same as for the other L-Systems:
const drawRules: Record<string, () => void> = {
V: () => {},
W: () => {},
X: () => {},
Y: () => {},
Z: () => {},
G: drawForward,
F: drawForward,
f: () => ctx.translate(0, -len),
"+": () => ctx.rotate(angle * rotationDirection),
"-": () => ctx.rotate(angle * -rotationDirection),
"|": () => ctx.rotate(180),
"[": () => ctx.push(),
"]": () => ctx.pop(),
"#": () => (ctx.lineWidth = weight += weightIncrement) ,
"!": () => (ctx.lineWidth = weight -= weightIncrement) ,
">": () => (len *= scale),
"<": () => (len /= scale),
"&": () => (rotationDirection = -rotationDirection),
"(": () => (angle += angleIncrement),
")": () => (angle -= angleIncrement),
};