Published
Edited
Oct 21, 2021
13 stars
Hello, A5Chandrupatla’s root-finding methodSidi’s root-finding methodRegular numbersDruidJS workerNatural breaksDistance to a segmentRay out of a convex hullWord Tour: 40k words and their friendsHello, @thi.ng/grid-iteratorsHead/tail breaksPseudo-blue noise shaderHow fast does walk-on-spheres converge?AoC 12: shortest path under constraintsKDE estimationPlot: Correlation heatmapPoisson Finish 2Poisson disk sampling functionsWoS with transportSimple and surprising sortLocal medianTime series topological subsamplingUnion-FindLevel set experiment 1Mean value coordinatesPoisson potentialMiddle-squareWorld of squares (spherical)World of squaresLargest Inscribed SquareHello, PyWaveletsGeothmetic meandianHello, Reorder.jsGeometric MedianImage FFTTransport to a mapDisc TransportTP3: Power Diagram and Semi-Discrete Optimal TransportThe blue waveHello, genetic-jsSliced Optimal TransportDruidJSSelf-Organizing Maps meet DelaunayHello, polygon-clippingseedrandom, minimal
Walk on Spheres 2
Walk on SpheresHello, AutoencoderKaprekar’s numberVoronoiMap2DHello, ccwt.jsPolygon TriangulationQuantile.invert?Linear congruential generatorHue blurNeedle in a haystackMoving average blurApollo 11 implementation of trigonometric functions, by Margaret H. Hamilton (march 1969)2D curves intersectionThe 2D approximate Newton-Raphson methodInverting Lee’s Tetrahedral projectionLinde–Buzo–Gray stipplingMean shift clustering with kd-tree2D point distributionsShortest pathKahan SummationHello, delatinDijkstra’s algorithm in gpu.jsLloyd’s relaxation on a graphManhattan DiameterManhattan VoronoiMobility landscapes — an introductionDijkstra’s shortest-path treeH3 odditiesProtein MatrixConvex Spectral WeightsSort stuff by similarityKrigingDelaunay.findTrianglen-dimensions binning?Travelling with a self-organizing mapUMAP-o-MaticMNIST & UMAP-jsHello UMAP-jsMean shift clusteringLevenshtein transitionRd quasi-random sequencesAutomated label placement (countries)Phyllotaxis explainedMotionrugsPlanar hull (Andrew’s monotone chain algorithm)South Africa’s medial axisTravelling salesperson approximation with t-SNEDistance to shoreWorkerngraph: pagerank, louvain…t-SNE VoronoiCloud ContoursCircular function drawingKruskal MazeMyceliumTravelling salesperson approximation on the globe, with t-SNEtsne.jstsne.js & worker
Insert cell
Insert cell
Insert cell
Insert cell
function closestCirclePoint(x, y, circle) {
const r = Math.hypot(x - circle.x, y - circle.y);
return {
dist: Math.abs(circle.r - r),
value: r < circle.r ? circle.inside : circle.outside
};
}
Insert cell
function closestBoundary(x, y) {
const boundaries = circles.map(circle => closestCirclePoint(x, y, circle));
return d3.least(boundaries, d => d.dist);
}
Insert cell
function walkOnSpheres(x, y) {
let steps = 10,
boundary;
do {
boundary = closestBoundary(x, y);
const phi = Math.random() * 2 * Math.PI;
x += boundary.dist * Math.cos(phi) * 0.999999999;
y += boundary.dist * Math.sin(phi) * 0.999999999;
} while (steps-- > 0 && boundary.dist > 1);
return boundary.value;
}
Insert cell
values = {
const RUNS = 7;
const values = new Float32Array(width * height);
for (let c = 0; c < RUNS; c++) {
for (let i = 0; i < width; i++) {
for (let j = 0; j < height; j++) {
const k = i + width * j;
values[k] = (c * values[k] + walkOnSpheres(i, j)) / (c + 1);
}
if (i % 60 === 0) {
yield values;
}
}
}
yield values;
}
Insert cell
color = d3.scaleSequential(d3[`interpolate${colorInterpolator}`])
Insert cell
colors = d3.range(0, 1, 1 / 256).map(v => d3.rgb(color(v)))
Insert cell
height = 500
Insert cell
circles = [
{ x: width / 2 - 100, y: height / 2 - 100, r: 99, inside: 0, outside: 1 },
{ x: width / 2 + 100, y: height / 2 - 100, r: 99, inside: 1, outside: 0 },
{ x: width / 2 - 100, y: height / 2 + 100, r: 99, inside: 1, outside: 0 },
{ x: width / 2 + 100, y: height / 2 + 100, r: 99, inside: 0, outside: 1 }
]
Insert cell
d3 = require("d3@6")
Insert cell
import { select } from "@jashkenas/inputs"
Insert cell
mutable pointers = []
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