Published
Edited
Sep 14, 2018
4 stars
Also listed in…
Projections
Insert cell
Insert cell
Insert cell
geoPolyhedralMurphey = function() {
const raw = d3.geoAzimuthalEqualAreaRaw;

function clipPole(lambda, phi) {
// approximation of the distance (in radians) to the ±80° circle
let pole = abs(phi) - 1 * lambda ** 2 - 0.78;
if (pole > 0) phi -= sign(phi) * pole;
return raw(lambda, phi);
}
clipPole.invert = raw.invert;

function faceProjection(face) {
return d3.geoProjection(clipPole).rotate([-face.site[0], -face.site[1]]);
}

return d3
.geoPolyhedralVoronoi()
.parents([-1, 0, 0, 1, 0, 4, 4, 5])
.angle(30)
.polygons(polygons)
.faceProjection(faceProjection)
.fitExtent([[0, 0], [width, width / 2]], { type: "Sphere" })
.rotate([35, 0])
.precision(0.1);
}
Insert cell
function octant(face) {
let poly = [];
let j = face.length - 1;
const N = 16;
for (let i = 0; i < face.length; i++, j = ++j % face.length) {
const interpolate = d3.geoInterpolate(face[j], face[i]);
let n;
for (n = 0; n <= N / 2; n++) poly.push(interpolate((0.1 + n) / (N + 1)));
poly.push(interpolate(0.499)); // anchor points
poly.push(interpolate(0.501));
for (n = n; n < N; n++) poly.push(interpolate((0.1 + n) / (N + 1)));
}
poly.push(poly[0]);
return { type: "Polygon", coordinates: [poly], face: face };
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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