Published
Edited
Apr 22, 2022
3 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function gasketInit(n) {
let init = [];
let theta0 = (2 * pi) / n;
for (let i = 0; i < n; i++) {
let theta = theta0 * i;
init.push([Math.cos(theta + pi / 2), Math.sin(theta + pi / 2)]);
}
return init;
}
Insert cell
function gasketIFS(n) {
let cos = Math.cos;
let sin = Math.sin;
let r =
sin(pi / n) /
(sin(pi / n) + sin(pi / n + (2 * pi * Math.floor(n / 4)) / n));
let ifs = [];
let theta0 = (2 * pi) / n;
for (let i = 0; i < n; i++) {
let theta = theta0 * i;
ifs.push(scale(r, [cos(theta + pi / 2), sin(theta + pi / 2)]));
}
return new IteratedFunctionSystem(ifs);
}
Insert cell
import { shift, scale, rotate, pi } from "@mcmcclur/affinefunction-class"
Insert cell
import { IteratedFunctionSystem } from "@mcmcclur/iteratedfunctionsystem-class"
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