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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more