Public
Edited
Apr 20
7 stars
Hello, A5
Hello, PGLiteINSEE ParquetHello, apcachDruidJS workerHello, OrbitWord Tour: 40k words and their friendsHello, spectral.jsHello, petite-vueHello, @thi.ng/grid-iteratorsHello, thumbhashHello, SwissGLHello, QOI (and glitches)Hello, orbHello, cosmographHello, TabulatorUsing d3.blur with PlotMath.cbrtHello debounceColorcetHello, gliiHello, Open MeteoHello, PyWaveletsHello, typesenseHello, libgifHello, kmeans-engineHappy anniversary, Project Gutenberg!Hello, fflateHello, ArchieML!Hello, d3-bboxCollideHello, jsgeoda!Hello, EDTF!Hello, protovis!Hello, placekeyHello, fuse.jsHello, Reorder.jsHello, shadow DOMjszipHello, procedural-glHello, qhullHello, genetic-jsDruidJSHello, Tippy.jsHello, paintWorkletBig πHello, AutoencoderHello, Shakespearean UUIDsHello, ccwt.jsHello, constrainautorHello, talismanHello, polygon-offsetHello p-queueHello async-poolHello rollup-plugin-asciiHello, algebra.jsHello, pixi.jsHello, d3-renderHello zip/unzipCumulative Wikipedia DonationsHTML <details>regl textureHello, npyjsHello protobufHello, pencil touchHello, LOESSHello html2canvaslegra mapscolor2cssHello, ecsy2D point distributionsHello, delatinThe gpu.js loopDijkstra’s shortest-path treeHello nojacko/Dijkstras-jsHello, tcort/dijkstrajsHello, lambdabaa/dijkstraHello, gpu.js v2Hello jsqrHello qrcodeHello SharedArrayBufferHello GamePad APIHello vtk.jsHello nd4jsHello BiofabricTravelling with a self-organizing mapHello glitchHello UMAP-jsHello pandemoniumHello iocaneHello JSON-editorHello d3-griddingHello mljs/knnWorkerHello lalolibImage to GPU.jsImage to blink.jsTissot's indicatrixVega projectionsHello WebCLGLUsing d3-inertia with observableVideo contouring 3ngraph: pagerank, louvain…Union-FindPerceptron (simple statistics)mljsHello h3-jsEmoji FlagsHello, poisson-disk-sampling
Also listed in…
Geo
Algorithms
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
A5 = import("https://esm.sh/a5-js")
Insert cell
children = A5.cellToChildren(0n, n)
Insert cell
mean = (4 * Math.PI) / children.length
Insert cell
penta = {
const mem = new Map();
return (cell) => {
if (!mem.has(cell)) {
const p = A5.cellToBoundary(cell);
const poly = rewind({
type: "Polygon",
coordinates: [[...p, p[0]].reverse()]
});
poly.area = d3.geoArea(poly);
mem.set(cell, poly);
}
return mem.get(cell);
};
}
Insert cell
import { rewind } from "@fil/rewind"
Insert cell
Insert cell
Plot.plot({
projection: { type: "equal-earth", rotate: [0, 0, 0.000001] },
marks: [
Plot.sphere({
stroke: "black",
fill: "white",
render: function (index, scales, values, dimensions, context, next) {
const g = next(index, scales, values, dimensions, context);
d3.select(g)
.select("path")
.on("click", (event, i) => {
console.log(cell);
mutable start = A5.bigIntToHex(A5.cellToParent(cell));
});
return g;
}
}),
Plot.graticule(),
Plot.geo(A5.cellToChildren(cell, A5.getResolution(cell) + 1), {
geometry: penta,
fill: "orange",
fillOpacity: 0.2,
stroke: "orange",
render: function (index, scales, values, dimensions, context, next) {
const g = next(index, scales, values, dimensions, context);
d3.select(g)
.selectAll("path")
.on("click", (event, i) => {
mutable start = A5.bigIntToHex(this.data[i]);
});
return g;
}
}),
Plot.geo(cell ? [cell] : [], { stroke: "red", geometry: penta })
]
})
Insert cell
cell = A5.hexToBigInt(start)
Insert cell
mutable start = "0"
Insert cell
mutable debug = null
Insert cell
areas = A5.cellToChildren(0n, 6).map((d) => d3.geoArea(penta(d)) * 4 ** 6)
Insert cell
A5.cellToChildren(cell).map((d) => A5.bigIntToHex(d))
Insert cell
A5.cellToChildren(cell)
Insert cell
A5.cellToLonLat(A5.hexToBigInt("635fb3a800000000"))
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