> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.bI3Fj4PPRk-/rev.1341
 * 
 * authors: 
 *   
 *   Janos Erdos Jr.

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



void setup() {     
    size(400, 400); 
}

void duplaspiral(float x1, float y1, float x2, float y2){
    final float d = dist(x1,y1,x2,y2), a = atan2(x1-x2,y1-y2);
    final float phi = 1.6180339887;
    final float A = 2.15, B=1;

    for(int radius = 0, d1 = d/phi, d1log=A*log(d1*B); radius < d1; radius+=1){
            float aa = a+A*log(radius*B)-d1log-PI;
            vertex(x1+sin(aa)*radius, y1+cos(aa)*radius);
    }

    for(int d1 = d-d/phi, d1log=A*log(d1*B), radius = d1; radius > 0; radius-=1){
            float aa = a+A*log(radius*B)-d1log;
            vertex(x2+sin(aa)*radius, y2+cos(aa)*radius);
    }
}
 
void arm(float x1, float y1, float x2, float y2){
    beginShape(POLYGON);
    duplaspiral(x1,y1,x2,y2);
    duplaspiral(x2,y2,x1,y1);
    endShape();     
}
 
void draw() {
   background(280,112,132);
   
   stroke(255);
    
    noStroke();
    fill(44);
 //   arm(width/2, height/2, mouseX, mouseY);
    translate(width/2, height/2);
    
    final float H = TWO_PI/3;
    
    arm(sin(H)*100, cos(H)*100, sin(H+H)*100,cos(H+H)*100);
    fill(255);
    arm(sin(H+H)*100, cos(H+H)*100, sin(0)*100,cos(0)*100);

    fill(123);
    arm(sin(0)*100, cos(0)*100, sin(H)*100,cos(H)*100);

    noLoop();
    
    
}