Published
Edited
Apr 23, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
circles = {
let circles = [{ cx: 0, cy: 0, r: 1 }];
let new_circles = [{ cx: 0, cy: 0, r: 1 }];
for (let i = 0; i < n; i++) {
new_circles = new_circles.map(cc).flat();
circles = circles.concat(new_circles);
}
return circles;
}
Insert cell
function cc(c) {
let { cx, cy, r } = c;

return d3.range(0, 2 * Math.PI, Math.PI / 4).map((t) => ({
cx: cx + r * Math.cos(t),
cy: cy + r * Math.sin(t),
r: s * r
}));
}
Insert cell
format = d3.format("0.6f")
Insert cell
s1 = 1 / (2 + Math.sqrt(2))
Insert cell
// Or s1 =
Math.sin(Math.PI / 8) / (Math.sin(Math.PI / 8) + Math.sin((5 * Math.PI) / 8))
Insert cell
s2 = Math.PI / (8 + Math.PI)
Insert cell
// Per Mootari's suggestions:
// https://talk.observablehq.com/t/sticky-slider/6471/2
import { snapRange } from "@mootari/snap-range"
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