import static util.SVGUtil.*;

public class Eyes {
    public static int hue = 0;
    final static int n = 5;    /* 子供の個数: 2--6 程度 */
        
    public static void generate(int d, double x, double y, double len) {
        if (d<=0) return;

        stroke(hsb360(hue, 100, 100));    
        hue += 15;             /* 色相の変化 */
        ellipse(x, y, len, len);
        for (int i=0; i<n; i++) {
            double s = sin360(180.0/n);
                        
            generate(d-1, x+len/2/(1+s)*sin360(360.0/n*i), y-len/2/(1+s)*cos360(360.0/n*i), len*s/(1+s));
        }
    }

    public static void main(String[] args) {
        start();
        rulers();

        strokeWeight(0.5);
        noFill();
        translate(centerX(), centerY());
        //          scale(1.414, 1);

        generate(5 /* 深さ */, 0, 0, pageHeight()/1.5);

        finish();
    }
}
