{"id":471,"date":"2012-11-12T07:25:57","date_gmt":"2012-11-12T07:25:57","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/?p=471"},"modified":"2012-11-12T07:26:50","modified_gmt":"2012-11-12T07:26:50","slug":"nature-image-2-growing-trees","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/12\/nature-image-2-growing-trees\/","title":{"rendered":"Nature image 2 &#8211; growing trees"},"content":{"rendered":"<p>I liked the idea of using processing to make a tree with which the leaves branched greatly and were very sporadic. It represented nature in that it is not tamed or maintained in a neat orderly predictable way. I used noise in various places and a great number of random variables. I played around with a lot of different ways of drawing the leaves before getting the leaves to look a way I was satisfied with. After making the leaves, I decided to make the trunk in a similar way. I had lines of random shades of brown going down to somewhat random locations. The trunk was made entirely of these lines giving it an interesting grainy effect. The fact that the lines all come from a single center point make it seem like you are looking up at the tree and it makes the tree look very tall. After I made the first large tree I decided to make a second smaller one that grows after the first finishes. I likes the effect of having a large tree looking over a newer smaller one. I also played around with the background color but ultimately decided to use black due to the bright shades of green and the somewhat light brown trunk. I suggest watching through until the picture is finished but at any point you may click mouse to start over. Some times a trunk will look like two trunks and some times it will look like one based on the line placement. A trunk may also look full or somewhat broken to one side. The image should never look exactly the same twice.<\/p>\n<p><script type=\"application\/processing\">\r\nfloat xtime;\r\nfloat ytime;\r\nfloat increment;\r\nint centerX;\r\nint centerY;\r\nint branches;\r\nint trunkGrowth;\r\n\r\nvoid setup(){\r\n  xtime = 0.0;\r\n  ytime = 100.0;\r\n  increment = .01;\r\n  centerX = 225;\r\n  centerY = 200;\r\n  branches = 0;\r\n  trunkGrowth = 0;\r\n  size(450, 750);\r\n  background(0,0,0);\r\n  smooth();\r\n  while(trunkGrowth < 1000){\r\n    smooth();\r\n    float lastX = centerX;\r\n    float lastY = centerY;\r\n    float ynoise = random(10);\r\n    float xnoise = random(10);\r\n      \/\/trunk\r\n    int r2 = int(random(2));\r\n    float re = random(60,150);\r\n    float gr = random(30, re);\r\n    float bl = random(0, gr);\r\n    stroke(re,gr,bl,200);\r\n    float newXT;\r\n    float newYT;\r\n    if(r2 == 0){\r\n      newXT = centerX + noise(xnoise)*100 -90;\r\n      newYT = centerY + noise(ynoise)*900 + 400;\r\n    }\r\n    else{\r\n      newXT = centerX - noise(xnoise)*100 - 90;\r\n      newYT = centerY + noise(ynoise)*900 + 400;\r\n    }\r\n    line(centerX, centerY,newXT,newYT);\r\n    trunkGrowth++;\r\n  }\r\n}\r\n\r\nvoid draw(){\r\n\r\n  if(branches < 300){\r\n    \r\n    smooth();\r\n    float lastX = centerX;\r\n    float lastY = centerY;\r\n    float ynoise = random(10);\r\n    float xnoise = random(10);\r\n    \/\/branches\r\n    stroke(0,random(10) * 25,0,200);\r\n    for (int i = 0; i < 100; i++){\r\n      int r = int(random(0,5));\r\n      float newX = lastX;\r\n      float newY = lastY;\r\n      if(r == 0){\r\n        newX = lastX + noise(xnoise)*20;\r\n        newY = lastY + noise(ynoise)*20;\r\n      }\r\n      else if(r==1){\r\n        newX = lastX - noise(xnoise)*20;\r\n        newY = lastY - noise(ynoise)*20;\r\n      }\r\n      else if(r==2){\r\n        newX = lastX + noise(xnoise)*20;\r\n        newY = lastY - noise(ynoise)*20;\r\n      }\r\n      else if(r==3){\r\n        newX = lastX - noise(xnoise)*20;\r\n        newY = lastY + noise(ynoise)*20;\r\n      }\r\n    \r\n      line(lastX,lastY,newX,newY);\r\n      lastX = newX;\r\n      lastY = newY;\r\n      ynoise += .1;\r\n    }\r\n    branches++;\r\n  }\r\n  else if (branches == 300){\r\n    anotherTrunk();\r\n    branches++;\r\n  }\r\n  else if (branches > 300 && branches < 400){\r\n    centerX = 400;\r\n    centerY = 600;\r\n    smooth();\r\n    float lastX = centerX;\r\n    float lastY = centerY;\r\n    float ynoise = random(10);\r\n    float xnoise = random(10);\r\n    \/\/branches\r\n    stroke(0,random(10) * 25,0,200);\r\n    for (int i = 0; i < 50; i++){\r\n      int r = int(random(0,5));\r\n      float newX = lastX;\r\n      float newY = lastY;\r\n      if(r == 0){\r\n        newX = lastX + noise(xnoise)*9;\r\n        newY = lastY + noise(ynoise)*9;\r\n      }\r\n      else if(r==1){\r\n        newX = lastX - noise(xnoise)*9;\r\n        newY = lastY - noise(ynoise)*9;\r\n      }\r\n      else if(r==2){\r\n        newX = lastX + noise(xnoise)*9;\r\n        newY = lastY - noise(ynoise)*9;\r\n      }\r\n      else if(r==3){\r\n        newX = lastX - noise(xnoise)*9;\r\n        newY = lastY + noise(ynoise)*9;\r\n      }\r\n    \r\n      line(lastX,lastY,newX,newY);\r\n      lastX = newX;\r\n      lastY = newY;\r\n      ynoise += .1;\r\n    }\r\n    branches++;\r\n  }\r\n}\r\n\r\nvoid anotherTrunk(){\r\n  centerX = 400;\r\n  centerY = 600;\r\n  trunkGrowth = 0;\r\n  while(trunkGrowth < 1000){\r\n    smooth();\r\n    float lastX = centerX;\r\n    float lastY = centerY;\r\n    float ynoise = random(10);\r\n    float xnoise = random(10);\r\n      \/\/trunk\r\n    int r2 = int(random(2));\r\n    float re = random(60,150);\r\n    float gr = random(30, re);\r\n    float bl = random(0, gr);\r\n    stroke(re,gr,bl,200);\r\n    float newXT;\r\n    float newYT;\r\n    if(r2 == 0){\r\n      newXT = centerX + noise(xnoise)*90 -90;\r\n      newYT = centerY + noise(ynoise)*90 + 400;\r\n    }\r\n    else{\r\n      newXT = centerX - noise(xnoise)*90 - 90;\r\n      newYT = centerY + noise(ynoise)*90 + 400;\r\n    }\r\n    line(centerX, centerY,newXT,newYT);\r\n    trunkGrowth++;\r\n  }\r\n}\r\n\r\nvoid mousePressed(){\r\n   setup();\r\n}\r\n<\/script><\/p>\n<p>EDIT: This looks different when I run it in processing on my computer. The center points of the leaves, and the points the trunks radiate from look different. These trunks look narrower than mine. The trunks here are always split as far as I can tell but on mine they are more commonly nearly full or at the very least much less split. It also looks sort of different in general to me. I apologize for this. I still like how the posted image looks but prefer my original.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I liked the idea of using processing to make a tree with which the leaves branched greatly and were very sporadic. It represented nature in that it is not tamed or maintained in a neat orderly predictable way. I used &hellip; <a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/12\/nature-image-2-growing-trees\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/471"}],"collection":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/comments?post=471"}],"version-history":[{"count":5,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/471\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/471\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}