Shell drawn using conchoid function
en.wikipedia.org/wiki/conchoid_(mathematics)
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(); function line(x1,y1,x2,y2){turtle.penup();turtle.goto(x1,y1);turtle.pendown();turtle.goto(x2,y2);} const subdiv = 100; const max_angle = Math.PI/2*0.95; const angle_range = max_angle*2; const da = angle_range/subdiv; let a = -2.5; let min_dis = 1; let max_dis = 90 let dis_range = max_dis-min_dis; // The walk function will be called until it returns false. function walk(i) { for(let dstep=min_dis+1;dstep<max_dis;dstep++) { let theta1 = -max_angle+da*i, theta2 = -max_angle+da*(i+1); let t = (dstep-min_dis)/dis_range; d = (1-t*t*t*t*t*t*t*t)*dis_range+min_dis; y1 = a+d*Math.cos(theta1), x1 = a*Math.tan(theta1)+d*Math.sin(theta1); y2 = a+d*Math.cos(theta2), x2 = a*Math.tan(theta2)+d*Math.sin(theta2); rt = t*0.5-1; line(x1+t*2+Math.random(),-y1+Math.random(),x2,-y2); line(x1+t*3+Math.random()*0.5,-y1+Math.random(),x2,-y2); line(x1+t*5+Math.random(),-y1+Math.random(),x2,-y2); line(x1+t+Math.random(),y1+Math.random(),x2,y2); line(x1+t*1+Math.random(),y1+Math.random(),x2,y2); line(x1+t*2+Math.random()*1.5,y1+Math.random(),x2,y2); } i++; return i < subdiv; }