Published
Edited
May 11, 2019
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function sinucyliFactory(t, phi0, switchAB = true) {
const { sin, cos, asin, sqrt } = Math;
//const k = t;
const k = sqrt(t);
const cosPhi0 = cos(phi0 * Math.PI / 180),
a = k + (1 - k) * cosPhi0,
b = k + (1 - k) / cosPhi0,
A = sqrt(a / b),
B = sqrt(b / a);
return (lambda, phi) => {
let sinPhi = sin(phi),
cosPhi = cos(phi);
return switchAB
? [
lambda * sqrt(1 - k * k * sinPhi * sinPhi) * A,
asin(k * sinPhi) / k * B
]
: [
lambda * cosPhi * cosPhi0 / cos(k * phi) * A,
sin(k * phi) / cosPhi0 / k * B
]
};
}
Insert cell
mutate = d3.geoProjectionMutator(sinucyliFactory)
Insert cell
projection = mutate(t, phi0, switchAB)
.precision(.1)
.fitExtent([[0, 0], [width, height]], {type: "Sphere"})
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