├── .gitignore ├── RectangleChaos ├── output-1582508756.pdf └── RectangleChaos.pde ├── example-001.pdf ├── example-002.pdf ├── example-003.pdf ├── example-004.pdf ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | -------------------------------------------------------------------------------- /RectangleChaos/output-1582508756.pdf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example-001.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raster/Rectangle-Chaos/master/example-001.pdf -------------------------------------------------------------------------------- /example-002.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raster/Rectangle-Chaos/master/example-002.pdf -------------------------------------------------------------------------------- /example-003.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raster/Rectangle-Chaos/master/example-003.pdf -------------------------------------------------------------------------------- /example-004.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raster/Rectangle-Chaos/master/example-004.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rectangle Chaos 2 | 3 | This is a Processing sketch that creates a grid of rectangles. 4 | 5 | You can adjust some variables to make things more chaotic as more rows are drawn. 6 | 7 | The output is a vector PDF file. 8 | 9 | For my #PlotterTwitter friends, have fun! 10 | 11 | You can read more about this here: 12 | 13 | http://rasterweb.net/raster/2019/01/29/rectangle-chaos/ 14 | 15 | --- 16 | 17 | Pete Prodoehl 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Pete Prodoehl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RectangleChaos/RectangleChaos.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * RectangleChaos.pde 3 | * 4 | * Pete Prodoehl 5 | * 6 | * 7 | * 8 | */ 9 | 10 | import processing.pdf.*; 11 | import java.util.Date; 12 | 13 | 14 | // set width and height of canvas as well as border at edges 15 | int canvasWidth = 1920; 16 | int canvasHeight = 1080; 17 | 18 | // most of the numbers below can be adjusted, play around with their values 19 | 20 | float xpos = 50; // x starting point in upper left 21 | float ypos = 50; // y starting point in upper left 22 | float wall = 150; // attempt to preserve whitespace on right side 23 | 24 | // size of square that we draw 25 | float rsize = 40; 26 | 27 | // step for square, smaller than rsize will overlap, larger will space apart 28 | float step = 50; 29 | 30 | // affects the jitter of rows: try 0.7 or 1.33 or 2.33 or 5.9 31 | float multiplierN = 2.35; 32 | 33 | 34 | float mimn = xpos; 35 | float rowct = 0; 36 | float multiple = 0; 37 | 38 | /* ----------------------------------------------------------- */ 39 | 40 | // get date to use for filename 41 | Date date = new Date(); 42 | long currentTime = date.getTime()/1000; 43 | 44 | 45 | void settings() { 46 | size(canvasWidth, canvasHeight); 47 | } 48 | 49 | void setup() { 50 | background(255); 51 | stroke(0); 52 | strokeWeight(1); 53 | beginRecord(PDF, "output-" + currentTime + ".pdf"); 54 | } 55 | 56 | void draw() { 57 | 58 | noFill(); 59 | 60 | float x1 = xpos; 61 | float y1 = ypos; 62 | 63 | multiple = rowct * multiplierN; 64 | 65 | if (rowct > 0) { 66 | x1 = xpos + random(0,multiple); 67 | y1 = ypos + random(0,multiple); 68 | } 69 | else { 70 | x1 = xpos; 71 | y1 = ypos; 72 | } 73 | 74 | float x2 = x1 + rsize; 75 | float y2 = y1; 76 | 77 | float x3 = x1 + rsize; 78 | float y3 = y1 + rsize; 79 | 80 | float x4 = x1; 81 | float y4 = y1 + rsize; 82 | 83 | float x5 = x1; 84 | float y5 = y1; 85 | 86 | beginShape(); 87 | vertex(x1,y1); 88 | vertex(x2,y2); 89 | vertex(x3,y3); 90 | vertex(x4,y4); 91 | vertex(x5,y5); 92 | endShape(); 93 | 94 | 95 | // end of a row 96 | if (xpos > (canvasWidth-wall)) { 97 | xpos = mimn; 98 | ypos = ypos + step; 99 | rowct++; 100 | } 101 | else { 102 | xpos = xpos + step; 103 | } 104 | 105 | // last row, then we save the PDF and exit 106 | if (ypos > (canvasHeight-wall)) { 107 | ypos = step; 108 | endRecord(); 109 | exit(); 110 | } 111 | 112 | } 113 | --------------------------------------------------------------------------------