Public
Edited
Sep 4, 2023
7 forks
180 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
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
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
function pdf(x, y) {
// PDF used for sampling initial positions. x and y in [0, 1], and returned value is in [0, 1].
return 1.0;

// Lots of little bumps:22
//return 0.9 + 0.1 * Math.cos(x * Math.PI * 16) * Math.sin(y * Math.PI * 16);

// Circular blob:
//var r2 = x * x + y * y;
//if (r2 > 0.2) return 0;
//return Math.exp(-r2 / Math.pow(0.3, 2));
}
Insert cell
function initialVelocity(out, x, y) {
out[0] = 0;
out[1] = 0;
return;

/*return [
0.0 * -Math.cos(x * Math.PI * 16) * Math.cos(y * Math.PI * 16),
0.0 * Math.sin(x * Math.PI * 16) * Math.sin(y * Math.PI * 16)
];*/

// Roughly circular orbit speed:
//var r = Math.sqrt(x * x + y * y);
//var speed =
// (4.5 - 3.5 * r + 0.5 * r * (1 - r)) * Math.pow(512 / gridTextureRadius, 1);
//out[0] = y * speed;
//out[1] = -x * speed;
}
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
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
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