Public
Edited
Nov 20, 2022
1 fork
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/*
* Buckminster Fuller’s spherical triangle transformation procedure
*
* Based on Robert W. Gray’s formulae published in “Exact Transformation Equations
* For Fuller's World Map,” _Cartographica_, 32(3): 17-25 (1995).
*
* Implemented for D3.js by Philippe Rivière, 2018 (https://visionscarto.net/)
*
* To the extent possible under law, Philippe Rivière has waived all copyright
* and related or neighboring rights to this implementation. (Public Domain.)
*/
function GrayFullerRaw() {
// standard symbols
var sqrt = Math.sqrt,
cos = Math.cos,
sin = Math.sin,
atan2 = Math.atan2,
SQRT_3 = sqrt(3);

// Gray’s constants
var Z = sqrt(5 + 2 * sqrt(5)) / sqrt(15),
el = sqrt(8) / sqrt(5 + sqrt(5)),
dve = sqrt(3 + sqrt(5)) / sqrt(5 + sqrt(5));

return function (lambda, phi) {
var cosPhi = cos(phi),
s = Z / (cosPhi * cos(lambda)),
x = cosPhi * sin(lambda) * s,
y = sin(phi) * s,
a1p = atan2((2 * y) / SQRT_3 + el / 3 - el / 2, dve),
a2p = atan2(x - y / SQRT_3 + el / 3 - el / 2, dve),
a3p = atan2(el / 3 - x - y / SQRT_3 - el / 2, dve);

return [SQRT_3 * (a2p - a3p), 2 * a1p - a2p - a3p];
};
}
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