hyperboloid 00

a doubly-ruled surface, z coordinate not explicitly stated but formulation results in a pseudo-orthographic projection

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 tt = new Turtle();
let nLines = 30;
let da = 2.0 * Math.PI/nLines;
tt.pd();

let offset = 1.95; // min=0, max=3.14159, step=0.1
let topY = -50; // min=-100, max=0, step=5
let bottomY = 50; // min=0, max=100, step=5
let topR = 20; // min=1, max=40, step=2
let bottomR = 20; // min=1, max=40, step=2

// The walk function will be called until it returns false.
function walk(i) {
    let a = i * da
    let x1 = 40 * Math.cos(a);
    let y1 = topY + topR * Math.sin(a);
    let x2 = 50 * Math.cos(a + offset);
    let y2 = bottomY + bottomR * Math.sin(a + offset);
    tt.jump(x1,y1);
    tt.goto(x2,y2);
    return i < nLines;
}