{"id":272,"date":"2012-11-05T15:04:57","date_gmt":"2012-11-05T15:04:57","guid":{"rendered":"http:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/?p=272"},"modified":"2012-11-05T15:04:57","modified_gmt":"2012-11-05T15:04:57","slug":"winters-outlook-assignment-1","status":"publish","type":"post","link":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/05\/winters-outlook-assignment-1\/","title":{"rendered":"Winter&#8217;s Outlook : Assignment 1"},"content":{"rendered":"<p>Its inspiration:<br \/>\n\tI was trying to figure out how to make triangle and rectangle and circles and all those simple shapes to seem more interesting. Then I thought What if I make an object up of itself; sort of like inception for shapes). That reminded me of Suerat&#8217;s &#8220;Sunday Afternoon [&#8230;]&#8221; which is a pointilism style creation. So I set my basis to make a winter scene using a style of pointilism. I tried not to step out of my coding ability by only using basic shapes.<\/p>\n<p>Its special powers:<br \/>\n\tI also figured I would add a little flare by having my &#8220;snowflakes&#8221; be randomly dimensioned ellipses. Also, I spent a while developing the code to be relative to the size of the window and the size of the &#8220;dots&#8221;. This allows for the image to be different each time but always similar, even if the window size or the &#8220;dot&#8221; size is changed.<\/p>\n<p>Its progress and debugging<br \/>\n\tThere are a few early attempts to see if I was coding right. If something was wrong I would comment out<br \/>\neverything and work my way done the code uncommenting until I found my issues.<\/p>\n<p><script type=\"application\/processing\">\r\n\/\/Info: http:\/\/processingjs.org\/reference\r\n\/\/ A Winter's Outlook\r\n\/\/\tBy: Alex Clemens\r\n\/\/      Oct. 31st\r\n\r\n\/\/ The grid will be set up so that each grid location is 6 across\r\n\/\/\tAnd each object in that location is 5 X 5\r\n\/\/\tLeaving a 1 space border\r\n\/\/\tThe edge of the picture will be removed so there is no outer border\r\n\r\n\/\/ PICTURE DRAWING STARTS ... ... ... ... NOW!!!\r\n\r\nint GRIDSIZE = 600;\r\nint BLOCKSIZE = 6;\r\nint BLOCKS = GRIDSIZE \/ BLOCKSIZE;\r\nint PICSIZE = BLOCKSIZE - 1;\r\n\r\nsize( GRIDSIZE - 1, GRIDSIZE - 1 );\r\nbackground( 255, 215, 0 ); \/\/ Gold backgound\r\nnoStroke();\r\n\r\n\/\/ accessory variable\r\n\/\/ These should not need to be greater than BLOCKS\r\nint i, j, x, y; \r\n\r\n\r\n\r\n\r\n\r\n\/\/ Create a border\r\n\r\n\/\/ Use background for gold inbetween black squares\r\n\r\nrectMode( CORNER );\r\n\r\n\r\nx = 0; \r\ny = 0;\r\n\r\nfill( 0 );\r\n\r\nfor ( i = 0; i < BLOCKS; i++)\r\n\trect( i * BLOCKSIZE, y , PICSIZE, PICSIZE );\r\n\r\nfor ( j = 0; j < BLOCKS; j++)\r\n        rect( x, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\nfor ( i = 0; i < BLOCKS; i++)\r\n\trect( i * BLOCKSIZE,  GRIDSIZE - BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\nfor ( j = 0; j < BLOCKS; j++)\r\n\trect( GRIDSIZE - BLOCKSIZE, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\n\r\n\/\/ Then inside is gold squares on silver background\r\nx = x + 1; \/\/ move x to next inner square of grid\r\ny = y + 1; \/\/ move y to next inner square of grid\r\n\r\nfill( 192, 192, 192 );\r\nrect( BLOCKSIZE, BLOCKSIZE, GRIDSIZE - ( 2 * x * BLOCKSIZE ) - 1 , GRIDSIZE - ( 2 * y * BLOCKSIZE ) - 1 );\r\n\r\n\r\nfill( 255, 215, 0 );\r\nfor( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, y * BLOCKSIZE , PICSIZE, PICSIZE );\r\n\r\nfor( j = y; j < BLOCKS - y; j++ )\r\n\trect( x * BLOCKSIZE, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\nfor( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, GRIDSIZE - ( 2 * y * BLOCKSIZE ) , PICSIZE, PICSIZE );\r\n\r\nfor( j = y; j < BLOCKS - y; j++ )\r\n\trect( GRIDSIZE - ( 2 * x * BLOCKSIZE ), j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\n\r\n\r\nx += 1; \/\/ move x to next inner square of grid\r\ny += 1; \/\/ move y to next inner square of grid\r\n\r\n\/\/ Fill is still gold\r\n\r\nfor ( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, y * BLOCKSIZE , PICSIZE, PICSIZE );\r\n\r\nfor ( j = y; j < BLOCKS - y; j++ )\r\n\trect( x * BLOCKSIZE, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\nfor ( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, GRIDSIZE - ( ( 2 * y - 1 ) * BLOCKSIZE ) , PICSIZE, PICSIZE );\r\n\r\nfor ( j = y; j < BLOCKS - y; j++ )\r\n\trect( GRIDSIZE - ( ( 2 * x - 1 ) * BLOCKSIZE ), j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\n\r\n\/\/ Then switch back.\r\n\r\nx += 1; \/\/ move x to next inner square of grid\r\ny += 1; \/\/ move y to next inner square of grid\r\n\r\nrect( BLOCKSIZE * x, BLOCKSIZE * y, GRIDSIZE - ( 2 * x * BLOCKSIZE ) - 1, GRIDSIZE - ( 2 * y * BLOCKSIZE ) - 1 );\r\n\r\nfill( 0 );\r\n\r\nfor ( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, y * BLOCKSIZE , PICSIZE, PICSIZE );\r\n\r\nfor ( j = y; j < BLOCKS - y; j++ )\r\n\trect( x * BLOCKSIZE, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\nfor ( i = x; i < BLOCKS - x; i++ )\r\n\trect( i * BLOCKSIZE, GRIDSIZE - ( ( 2 * ( y - 1 ) ) * BLOCKSIZE ) , PICSIZE, PICSIZE );\r\n\r\nfor ( j = y; j < BLOCKS - y; j++ )\r\n\trect( GRIDSIZE - ( ( 2 * ( x - 1 ) ) * BLOCKSIZE ), j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n\r\n\r\n\r\n\r\n\r\n\r\n\/\/ Border is finished, Now for the inner picture.\r\n\r\n\/\/ Inner background\r\n\r\nfill( 192, 192, 192 ); \/\/ silver\r\n\r\nx += 1; \/\/ move x to next inner square of grid\r\ny += 1; \/\/ move y to next inner square of grid\r\n\r\nrect( BLOCKSIZE * x, BLOCKSIZE * y, GRIDSIZE - ( 2 * x * BLOCKSIZE ) - 1, GRIDSIZE - ( 2 * y * BLOCKSIZE ) - 1 );\r\n\r\n\/\/ Break in design 1\/3 of the way up the grid\r\n\r\nint picBreak = int( 2 * ( GRIDSIZE - ( 2 * x * BLOCKSIZE ) ) \/ 3 );\r\npicBreak = ( picBreak \/ BLOCKSIZE ) - ( picBreak % BLOCKSIZE );\r\n\r\n\/\/ Make the sky blue-ish in the sky area\r\n\r\nfill( 192, 192, 215 );\r\nrect( x * BLOCKSIZE + 1, y * BLOCKSIZE + 1, GRIDSIZE - ( 2 * x * BLOCKSIZE ) - 2, ( picBreak - x ) * BLOCKSIZE );\r\n\r\n\/\/ Place a winter scene\r\n\r\n\r\n\/\/ Add snow drops\r\n\r\n\/\/ more ints for random number generation\r\n\r\nint ran1, ran2;\r\n\r\n\/\/ Set fill\r\n\r\nfill( 255 ); \/\/ White\r\nstroke( 0 );\r\n\r\nfor( j = y; j < BLOCKS - y; j++ )\r\n{\r\n\tif( j == picBreak )\r\n\t{\r\n\t\tfill( 0 );\r\n\t\tstroke( 255 );\r\n\t}\r\n\r\n\t\tfor( i = x; i < BLOCKS - x; i++ )\r\n\t\t{\r\n\t\t\tran1 = int( random( 2, PICSIZE + 1 ) );\r\n\t\t\tran2 = int( random( 2, PICSIZE + 1 ) );\r\n\t\t\tellipse( i * BLOCKSIZE + 1, j * BLOCKSIZE + 1, ran1, ran2 );\r\n\t\t}\r\n\r\n\tif( j == picBreak )\r\n\t{\r\n\t\tfill( 255 );\r\n\t\tnoStroke();\r\n\t}\r\n}\r\n\r\n\r\n\/\/ Add a tree\r\n\r\nx += 1; \/\/ limit the tree from going all the way to the border\r\ny += 1;\r\n\r\nint TriTopX, TriBotLY, TriBotRX, TriBotRY;\r\n\r\nTriTopX = int( BLOCKSIZE \/ 2 );\r\nTriBotLY = PICSIZE;\r\nTriBotRX = PICSIZE;\r\nTriBotRY = PICSIZE;\r\nint treeWidth = 0;\r\n\r\n\/\/int treeTopx = int( 2 * ( GRIDSIZE - ( 2 * x * BLOCKSIZE ) ) \/ 3 );\r\nint treeTopx = picBreak + x;\r\n\r\n\/\/int treeTopy = int( ( GRIDSIZE - ( 2 * x * BLOCKSIZE ) ) \/ 3 );\r\nint treeTopy = ( picBreak + y ) \/ 2;\r\n\r\nint treeBottom = ( treeTopy * 2 );\r\n\r\n\/\/Add leaves\r\n\r\nfill( 34, 139, 34 ); \/\/Forest Green\r\n\r\nint treeBreak1 = int( treeTopy + ( treeTopy \/ 3) );\r\nint treeBreak2 = int( treeTopy + ( ( 2 * treeTopy) \/ 3) );\r\n\r\nfor( j = treeTopy; j < treeBottom; j++, treeWidth++)\r\n{\r\n\tif( j == treeBreak1 || j == treeBreak2 )\r\n\t\ttreeWidth = treeWidth \/ 3;\r\n\r\n\tfor( i = treeTopx - treeWidth; i <= treeTopx + treeWidth; i++ )\r\n\t\ttriangle( i * BLOCKSIZE, j * BLOCKSIZE + TriBotLY, i * BLOCKSIZE + TriTopX, \r\n                          j * BLOCKSIZE, i * BLOCKSIZE + TriBotRX, j * BLOCKSIZE + TriBotRY );\r\n\t\r\n\tif( j > treeBreak1 )\r\n\t{\r\n\t\tif( j > treeBreak2 )\r\n\t\t\ttreeWidth++;\r\n\t\telse if( 0 == ( treeWidth % 3 ))\r\n\t\t\ttreeWidth++;\r\n\t}\r\n}\r\n\r\n\/\/ tree trunk\r\n\r\nint trunkWidthHalf = int( treeWidth \/ 6 );\r\nint trunkHeight = treeBottom + ( treeTopy \/ 4 );\r\n\r\nfill( 160, 82, 45 ); \/\/ Brown for the trunk, Sienna\r\n\r\nfor( i = treeTopx - trunkWidthHalf; i < treeTopx + trunkWidthHalf; i++ )\r\n{\r\n\tfor( j = treeBottom; j < trunkHeight; j++ )\r\n\t\trect( i * BLOCKSIZE, j * BLOCKSIZE, PICSIZE, PICSIZE );\r\n}\r\n\r\n\r\n\r\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Its inspiration: I was trying to figure out how to make triangle and rectangle and circles and all those simple shapes to seem more interesting. Then I thought What if I make an object up of itself; sort of like &hellip; <a href=\"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/2012\/11\/05\/winters-outlook-assignment-1\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":14,"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\/272"}],"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\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/comments?post=272"}],"version-history":[{"count":3,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/272\/revisions"}],"predecessor-version":[{"id":279,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/posts\/272\/revisions\/279"}],"wp:attachment":[{"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/media?parent=272"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/categories?post=272"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshuarosenstock.com\/teaching\/IMGD3x00_B12\/wp-json\/wp\/v2\/tags?post=272"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}