Public
Edited
Jul 10, 2020
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
heightmap
Insert cell
heightmap
Insert cell
viewof shademap = {
const Nc = 256;
const { context, dispatch } = viewofCanvas(Nc, Nc);
const { data, hunit, vunit } = heightmap;
const sun = 15 * (τ / 360); // sun elevation (in radians)
const S = computeShading(
data,
[hunit, vunit],
[0, -Math.cos(sun), Math.sin(sun)],
0.7,
256
);

dispatch({
heightmap: { data, hunit, ratio: vunit / hunit },
colormap: { data: S }
});
return canvas(context, (i, j) => Array(3).fill(S[i * 2][j * 2]));
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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