417

--

Generative Art

Update:

I have found a way to implement the techniques developed in this course to make randomly generated wood sculptures.

31059488_136585037192506_919551272719430

Original:

Taking inspiration from the submission by user Russ Parker, I tried my hand at my own hexagonal grid pattern. I don't know how he made his, but mine uses 13 svg files with different groupings and the line HShape d = new HShape("hex"+str(int(round(random(0, 12))))+".svg"); Without int the string will include ".0," and without round the string will only select 0-11.

To create a base hexagon with 12 sections create an equilateral triangle in inkscape with one leg oriented vertically. Use the selection tool to set its height to one half the desired height of the hexagon with proportionate scaling enabled, then copy and paste until you have six: 3 pointing left and three pointing right. Put one facing left at 0,0 (the bottom left corner will be lined up with the bottom left corner of the page). Then one facing right at (0,height/2), then one facing left at (0,height). Then do the other three with x set to the width. Make an additional six triangles that are half that height positioned at ([width/2, width], [height/2, 3/4height, height]). Save this as it is after following this guide https://github.com/analogpixel/inkscapeHype. Then to generate hexagons that guarantee certain patterns emerge, shift click triangles you want to group, shift+k to make the groupings, then save under a new name. Do this for however many patterns you want to generate and name them in such a way as to facilitate random selection.

306414b6

float hexscale = 1;
float hexheight = hexscale*100;
float hexwidth = hexscale*86.6025403784;
float margin = 0.2;

void setup(){
    size(1920,1080);
    H.init(this).background(#333333).autoClear(false);//initialize HYPE
    HColorPool colors = new HColorPool(#FFFFFF,#F7F7F7,#ECECEC,#0095A8,#00616F,#333333,#FF3300,#FF6600);

    //the first row has an unoverlapped point. subtract 25% of hexheight to require that much extra for first row
    //then for every additional 75% available space allow one more row
    for (int row = 0; row < floor((height-(0.25+2*margin)*hexheight)/(0.75*hexheight)); ++row) {
        float basex = (hexwidth*(margin+0.5+(0.5*(row%2)))) //start to the right of margin or half width over on odd rows
            + ((width - 2*margin*hexwidth)%hexwidth)/2; //shift half the remainder as well in order to center x
        float basey = hexheight*(margin+0.5+(0.75*row)); //start below margin plus .75 height for each row
        //don't center y because this is a wallpaper and the start bar eats the excess

        //odd rows have one less column, even rows have as many as can fit within the margin
        for (int col = 0; col < floor((width - 2*margin*hexwidth)/hexwidth)-(row%2); ++col) {
            HShape d = new HShape("hex"+str(int(round(random(0, 12))))+".svg");
            H.add(d)
            .noStroke()
            .anchorAt(H.CENTER)
            .loc(basex+hexwidth*col,basey)
            .scale(hexscale);

            d.randomColors(colors.fillOnly());
        }
    }

    H.drawStage();
    save("hex.png");
}b1d35d33

404ba2f1

Comments

Please sign in or sign up to comment.