Published
Edited
Dec 10, 2021
2 stars
Also listed in…
Math
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
T1 = T.map((xy) =>
math.add(math.multiply(S, AInv, SInv, xy), math.multiply(S, AInv, [1, 0]))
)
Insert cell
T0 = T.map((xy) => math.multiply(S, AInv, SInv, xy))
Insert cell
T = {
let T = [
[
[
[0, 0],
[1, 0],
[1, 1],
[0, 1]
]
]
];
let n = 15;
for (let i = 0; i < n; i++) {
T = multi_polygon_step(T, i);
}
let An = math.pow(math.inv(A), n);
T = T.map((p) => p.map((pts) => pts.map((xy) => math.multiply(S, An, xy))));
T = T.flat(2); // Extra step in the simply connected case
return T;
}
Insert cell
function polygon_step(p, n) {
let An = math.pow(A, n);
return D.map(function (d) {
return p.map((a) => a.map((aa) => math.add(math.multiply(An, d), aa)));
});
}
Insert cell
function multi_polygon_step(mp, n) {
return polygonClipping.union(...mp.map((p) => polygon_step(p, n)));
}
Insert cell
function step(T, n) {
let An = math.pow(A, n);
return polygonClipping.union(
...base_digit_set(A).map(function (d) {
return [T.map((xy) => math.add(math.multiply(An, d), xy))];
})
)[0][0];
}
Insert cell
SInv = math.inv(S)
Insert cell
S = [
[0, math.sqrt(7) / 2],
[1, 1 / 2]
]
Insert cell
D = base_digit_set(A)
Insert cell
AInv = math.inv(A)
Insert cell
A = [
[1, 2],
[-1, 0]
]
Insert cell
math = require("mathjs")
Insert cell
polygonClipping = require("polygon-clipping")
Insert cell
import { digit_pic, base_digit_set } from "@mcmcclur/self-affine-tiles"
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