Published
Edited
Mar 7, 2020
3 forks
Also listed in…
Projections
Insert cell
Insert cell
Insert cell
Insert cell
{
fullscreen(canvas, { center: true });
const drawgl = createDrawCommand(regl);
do {
const lon = +((Date.now() / 100) % 360).toFixed(2);
projection.rotate([lon, eye.match(/north/) ? 90 : -90]);
drawgl();
canvas.render();
yield lon;
} while (true);
}
Insert cell
// Image source https://www.solarsystemscope.com/textures/
image = FileAttachment("8k_jupiter.jpg")
.image()
.then(d => Object.assign(d, { style: "max-height:100px" }))
Insert cell
projection = d3.geoProjection(d3.geoHammerRaw(1.75, 2)).rotate([-10, 90])
Insert cell
breisemeister = () => `
x /= 1.75;
float rho = sqrt(x * x + y * y);
if (rho > sqrt(2.0)) {
transparent = true;
} else {
float c = 2.0 * asin(rho / 2.0);

float sinc = sin(c);
float cosc = cos(c);

lambda = 2.0 * atan(x * sinc, rho * cosc);
phi = asin(y * sinc / rho);
}
`
Insert cell
projection.fitExtent([[10, 10], [width - 10, height - 10]], { type: "Sphere" })
Insert cell
glproj = breisemeister()
Insert cell
import { reglCanvas, createDrawCommand, regl, fullscreen, height } with {
width,
projection,
glproj,
image
} from "@fil/phytoplankton"
Insert cell
d3 = require("d3-geo", "d3-geo-projection")
Insert cell
import { radio } from "@jashkenas/inputs"
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