Draw n Chords
Allows changing the angle at the cost of increased pen up distance
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(1); // https://www.varsitytutors.com/intermediate_geometry-help/how-to-find-the-length-of-a-chord // Chord length using perpendicular distance from the center = 2 × √(r2 − d2). // https://www.cuemath.com/geometry/Chords-of-a-circle/ // Released under the MIT licence // https://mit-license.org/ // you can use this for commercial gain if you like eg you can sell artworks with this image. const numLines=160; // min=0 max=160 step=1 const angle=0; // min=0 max=360 step=1 const gap=1; // min=0.5 max=3 step=0.1 const turtle = new Turtle(); let d = 0; let d2 = d * d; let r = 80; let r2 = r * r; let chordLength; for(let n=0; n < numLines; n = n + gap){ d = n -80; d2 = d * d; chordLength = 2 * Math.sqrt(r2 - d2); turtle.jump(0,-80 + n); turtle.seth(angle); turtle.penup(); turtle.forward(chordLength /2); turtle.pendown(); turtle.back(chordLength); }