Public
Edited
Nov 14, 2023
3 stars
Also listed in…
Digraph Fractals
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
curvesDigraphIFS = new DigraphIFS([
{
source: "A",
target: "A",
f: shift([1 / 4, Math.sqrt(3) / 4]).compose(scale(1 / 2)),
label: "fAA"
},
{
source: "A",
target: "B",
f: rotate(pi / 3).compose(scale(1 / 2)),
label: "fAB"
},
{
source: "A",
target: "B",
f: shift([3 / 4, Math.sqrt(3) / 4])
.compose(rotate(-pi / 3))
.compose(scale(1 / 2)),
label: "gAB"
},
{
source: "B",
target: "A",
f: shift([1 / 2, 0]).compose(reflect([0, 1]).compose(scale(1 / 2))),
label: "fBA"
},
{
source: "B",
target: "B",
f: scale(1 / 2),
label: "fBB"
}
])
Insert cell
Insert cell
curvesDigraphIFS.show_digraph()
Insert cell
Insert cell
stochastic_pics = curvesDigraphIFS.render_stochastic({})
Insert cell
Insert cell
stochastic_pics[0]
Insert cell
Insert cell
Insert cell
curvesDigraphIFS.render_deterministic("A", { max_depth: 7 })
Insert cell
Insert cell
Insert cell
{
let canvases = ["A", "B"].map((node, i) =>
curvesDigraphIFS.render_deterministic(node, {
pad: 0,
max_depth: iteration_depth,
image_width: width / 2,
initiators: [
[
[0, 0],
[1, 0]
],
[
[0, 0],
[1, 0]
]
],
colors: true,
extent:
i == 0
? [
[-0.1, 1.1],
[-0.1, 1.1]
]
: [
[-0.1, 1.1],
[-0.6, 0.5]
]
})
);

let w = width;
let h = canvases[0].height;
let div = d3
.create("div")
.style("width", `${width}px`)
.style("height", `${h}px`)
.style("position", "relative");
canvases.forEach((c) => div.append(() => c));

return div.node();
}
Insert cell
Insert cell
import {
scale,
shift,
rotate,
reflect,
pi,
DigraphIFS
} from "@mcmcclur/digraphifs-class"
Insert cell
MathJax = require("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js").catch(
() => window["MathJax"]
)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more