Published
Edited
Dec 6, 2021
1 star
Also listed in…
Fractals
Insert cell
Insert cell
Insert cell
// You can edit this to generate your own tile.
A = [
[2, -2],
[2, 0]
]
Insert cell
Insert cell
Insert cell
IFS = {
let AInv = math.inv(A);
return new IteratedFunctionSystem(
base_digit_set(A).map(
(d) => new AffineFunction([AInv, d]) // math.multiply(AInv, d)
)
);
}
Insert cell
Insert cell
basic_picture = IFS
// .iterate(3) // Uncomment this to generate a higher order tiling
.render_stochastic({
n: 200000,
colors: true,
image_width: width < 800 ? width : 800
})
Insert cell
Insert cell
base_digit_set(A)
Insert cell
Insert cell
Insert cell
Insert cell
digit_pic(A)
Insert cell
Insert cell
D = [
[0, 0],
[1, 1],
[-1, 0],
[0, -1]
]
Insert cell
differentD = {
let AInv = math.inv(A);
return (
new IteratedFunctionSystem(D.map((d) => new AffineFunction([AInv, d])))
//.iterate(3) // Uncomment this to generate a higher order tiling
.render_stochastic({
n: 200000,
colors: true,
image_width: width < 800 ? width : 800
})
);
}
Insert cell
Insert cell
Insert cell
different_basis = {
let S = [
[1, -1 / 2],
[0, math.sqrt(3) / 2]
];
let SAInvSInv = math.multiply(S, math.inv(A), math.inv(S));
return (
new IteratedFunctionSystem(
D.map((d) => new AffineFunction([SAInvSInv, math.multiply(S, d)]))
)
//.iterate(3) // Uncomment this to generate a higher order tiling
.render_stochastic({
n: 200000,
colors: true,
image_width: width < 800 ? width : 800
})
);
}
Insert cell
Insert cell
Insert cell
evd = new mlm.EigenvalueDecomposition(A)
Insert cell
is_expansive = evd.d[0] ** 2 + evd.e[0] ** 2 > 1 &&
evd.d[1] ** 2 + evd.e[1] ** 2 > 1
Insert cell
det = A[0][0] * A[1][1] - A[0][1] * A[1][0]
Insert cell
Insert cell
import { base_digit_set, digit_pic } from "@mcmcclur/self-affine-tiles"
Insert cell
import {
AffineFunction,
IteratedFunctionSystem,
shift,
rotate,
degree,
pi
} from "@mcmcclur/iteratedfunctionsystem-class"
Insert cell
mlm = require("ml-matrix")
Insert cell
math = require("mathjs")
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