Published
Edited
Feb 11, 2018
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function err(x, y, r) { return Math.abs(x*x + y*y - r*r) }
Insert cell
function* arc45(radius) {
var errX1, errX;
for (
var x=radius, x1=x-1, y=0;
y < x; // angle is 45 degrees when x and y are equal
x1=x-1, y++
) {
errX1 = err(x1, y, radius), errX = err(x, y, radius);
if (errX1 < errX) {
x=x1
}
yield {x, y, errX1, errX};
}
}
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