Published
Edited
Apr 2, 2021
17 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 580
Insert cell
h = 240
Insert cell
points0 = [[0, 0]].concat(
d3
.range(n)
.map(i => [Math.cos((i / n) * tau) * h, Math.sin((i / n) * tau) * h])
)
Insert cell
points = {
let points = points0.slice();
let count = 0;
for (let stage = 0; stage < steps; stage++) {
const d = d3.Delaunay.from(points);
for (const p of d.trianglePolygons()) {
// instead of centroid, use the triangle's circumcenter?
points.push(Object.assign(d3.polygonCentroid(p.slice(0, 3)), { stage }));
if (count++ % 100 === 0) yield points;
}
}
yield points;
}
Insert cell
color = d3.scaleSequential(d3.interpolateTurbo).domain([0, steps + 1])
Insert cell
tau = 2 * Math.PI
Insert cell
d3 = require("d3@6")
Insert cell
import {Range} from "@observablehq/inputs"
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