The bounding edge of this describes sqrt(x) + sqrt(y) = 1, which is a very interesting equation.
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
// Global code will be evaluated once.
const turtle = new Turtle();
const line_pairs = 20;
const incr = 100/line_pairs
// The walk function will be called until it returns false.
function walk(j) {
const i = j + 0.5
// we want two lines.
// one goes from (0, -100 + 10i) to (10i, 0).
// slope is (100 - 10i)/(10i) = 10/i - 1
const b = -100 + incr*i
const m = -b/(incr*i)
turtle.penup()
turtle.goto(-100, m*(-100) + b);
turtle.pendown();
turtle.goto((100 - b)/m, 100);
// the other goes from (-10i, 0) to (0, 100 - 10i)
// slope is 10/i - 1 again but intercept is 100 - 10i,
const b2 = 100 - incr*i
turtle.penup()
turtle.goto(-100, m*(-100) + b2);
turtle.pendown();
turtle.goto((100 - b2)/m, 100);
turtle.penup()
return i < line_pairs;
}