├── .gitignore
├── README.md
├── README_archived.md
├── benjamin_fox
└── vol2no4cover
│ ├── lines.pde
│ ├── tile.pde
│ └── vol2no4cover.pde
├── calvin_hu
├── P210
│ └── P210.pde
├── cubelimitseries
│ └── cubelimitseries.pde
└── cubelimitseries_rotation
│ └── cubelimitseries_rotation.pde
├── chris_allick
├── GeorgNeesUntitled18
│ └── GeorgNeesUntitled18.pde
├── JeanClaudeMarquette
│ └── JeanClaudeMarquette.pde
├── RandomSquares
│ └── RandomSquares.pde
└── Untitled1
│ └── Untitled1.pde
├── daniel_howe
├── RasterWalk
│ ├── .gitignore
│ ├── index.html
│ └── rasterwalk.js
└── VoronoiRecode
│ ├── Delaunay.pde
│ └── VoronoiRecode.pde
├── genevieve_hoffman
├── Aaron_Marcus_Untitled_1
│ └── Aaron_Marcus_Untitled_1.pde
├── Aaron_Marcus_Untitled_2
│ └── Aaron_Marcus_Untitled_2.pde
└── Reiner_Schneeberger_Untitled2_Various
│ └── Reiner_Schneeberger_Untitled2_Various.pde
├── gerald_kogler
└── VariationOn9Squares
│ ├── Square.pde
│ └── VariationOn9Squares.pde
├── greg_borenstein
└── StructuredSquareSeriesInwards
│ └── StructuredSquareSeriesInwards.pde
├── hugh_kennedy
└── untitled2
│ └── untitled2.pde
├── isaac_gierard
└── StevenHCullinane_DiamondTheory
│ └── StevenHCullinane_DiamondTheory.pde
├── jon_bobrow
├── ExperimentalEsthetics_04
│ └── ExperimentalEsthetics_04.pde
├── ExperimentalEsthetics_05
│ └── ExperimentalEsthetics_05.pde
└── ExperimentalEsthetics_06
│ └── ExperimentalEsthetics_06.pde
├── krystof_pesek
└── Structure
│ └── Structure.pde
├── kyle_mcdonald
├── RandomSquares
│ ├── RandomSquares.pde
│ ├── Rosetta.pde
│ └── Vernacular.pde
└── StructuredSquareSeriesInwards
│ └── StructuredSquareSeriesInwards.pde
├── leander_herzog
└── organicIllusion
│ └── organicIllusion.pde
├── martin_schneider
├── dynamic_object
│ └── dynamic_object.pde
├── galois_orbits
│ └── galois_orbits.pde
├── untitled_1
│ └── untitled_1.pde
├── untitled_2
│ └── untitled_2.pde
└── untitled_3
│ └── untitled_3.pde
├── mary_scahill
└── kubusSerie
│ └── kubusSerie.pde
├── michael_price
├── Zup_Tze
│ └── Zup_Tze.pde
└── creature_tunnel
│ ├── animals.pde
│ └── creature_tunnel.pde
├── mitchell_whitelaw
└── sykora_reCode
│ └── sykora_reCode.pde
├── nick_santaniello
├── crosses
│ ├── Cross.pde
│ └── crosses.pde
├── nubs
│ └── nubs.pde
├── square_towers
│ └── square_towers.pde
└── structured_squares
│ └── structured_squares.pde
├── paul_may
└── wehrner
│ └── wehrner.pde
├── quin_kennedy
├── recode__v3n2_untitled
│ └── recode__v3n2_untitled.pde
├── recode_v1n2_universal_declaration_of_human_rights
│ ├── data
│ │ ├── Krungthep-10.vlw
│ │ ├── Krungthep-12.vlw
│ │ ├── KufiStandardGK-10.vlw
│ │ ├── Universal Declaration of Human Rights.txt
│ │ ├── frag.glsl
│ │ └── girl_gaze_contrast1_small2.jpg
│ └── recode_v1n2_universal_declaration_of_human_rights.pde
├── recode_v1n3_Exploitation_Quantitative_et_Qualitative_do_Program
│ └── recode_v1n3_Exploitation_Quantitative_et_Qualitative_do_Program.pde
├── recode_v1n3_untitled_1
│ └── recode_v1n3_untitled_1.pde
├── recode_v1n3_untitled_2
│ └── recode_v1n3_untitled_2.pde
├── recode_v1n3_untitled_3
│ └── recode_v1n3_untitled_3.pde
├── recode_v1n3_untitled_4
│ └── recode_v1n3_untitled_4.pde
├── recode_v2n3_Segrid_by_John_Roy
│ └── recode_v2n3_Segrid_by_John_Roy.pde
├── recode_v3n2_From_the_Square_Series_by_Roger_Coqart
│ └── recode_v3n2_From_the_Square_Series_by_Roger_Coqart.pde
├── recode_v3n2_unimaginable_images_Vera_Molnar
│ └── recode_v3n2_unimaginable_images_Vera_Molnar.pde
└── recode_v3n2_untitled_Vera_Molnar
│ └── recode_v3n2_untitled_Vera_Molnar.pde
├── sermad_buni
├── boxes
│ └── boxes.pde
└── traveling_through_the_square_series
│ ├── square.pde
│ └── traveling_through_the_square_series.pde
└── steve_berrick
├── HexVariations
└── HexVariations.pde
└── HexVariationsRegular
└── HexVariationsRegular.pde
/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 | *.pdf
3 | *.tif
4 | *.jpg
5 | *.png
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This repo is no longer being used as the central repository for the ReCode Project. All additions to the project should be submitted on our site.
2 |
3 | I will continue to receive notifications regarding issues, but it's probably better just to use the email address below.
4 |
5 | These files will remain here indefinitely. Please contact me if you have questions.
6 |
7 | ReCode Project
8 | ==============
9 | http://www.recodeproject.com/
10 | info@recodeproject.com
11 | @ReCodeProject
--------------------------------------------------------------------------------
/README_archived.md:
--------------------------------------------------------------------------------
1 | ReCode Project
2 | ==============
3 | http://www.recodeproject.com/
4 | info@recodeproject.com
5 | @ReCodeProject
6 |
7 |
8 | An active archive of computer art.
9 |
10 | This project aims to resurrect forgotten works of computer art and port them to a language that is widely used, easily accessibly to beginners, and advanced enough to build upon the original artworks to create new ones. For these reasons, we have chosen Processing as the common language for this project due to its widespread use (particularly in educational environments), extensive documentation, and active community of developers and contributors.
11 |
12 | Our current focus is on translating works found in issues of "Computer Graphics and Art" 1976-1978. PDFs of the original documents can be found in the "Downloads" section of this repo or on our site.
13 |
14 | All sketches are licensed under CC BY-SA 3.0.
15 |
16 |
17 | HOW TO SUBMIT A TRANSLATION
18 | --------------------
19 | If you would rather not use GitHub to submit your work, please just create a zip file of your work and send it to us via email: info@recodeproject.com
20 |
21 | If you would like to contribute via GitHub, follow these steps:
22 |
23 | 1. Go to the website and pick one out you want to translate.
24 |
25 | 2. Decide if you want to do a direct translation (the end result looks just like the original) or an experimental translation (it does something different).
26 |
27 | 3. Open up Processing and go nuts.
28 |
29 | 4. Fork this repo and clone it to your machine.
30 |
31 | 5. Add a folder with your name like this: firstName_lastName (all lower case). Put your project folder(s) in that folder. For example: firstName_lastName > myTranslation > myTranslation.pde.
32 |
33 | 5. Do NOT include images in your folders.
34 |
35 | 6. Send a pull request. In the notes, please include the URL to the original piece on our site and what category your translation is in (direct translation or experimental).
36 |
37 | We will merge your request, run the code and take a screenshot and upload your translation to our site. If the translation requires a video, we'll do that for you too.
38 |
39 | If you want to make any changes to your translation or remove it, please email us (info@recodeproject.com)
40 |
41 |
42 | FAQ's
43 | -----
44 | Q: Do I have to use GitHub to participate?
45 | A: No. Email us your Processing project folder if you want. Our email is: info@recodeproject.com
46 |
47 | Q: Are you or other people on this repo going to steal my work?
48 | A: This is an open source project. All work is available for use so long as the original author(s) are given credit.
49 |
50 | Q: Where did you find this stuff?
51 | A: Rhizome.org posted these pdfs, which were originally published by compart (dada.compart-bremen.de)
52 |
53 | Q: Are you going to do more of this?
54 | A: Yes. We will be adding more as we find it. Feel free to point us towards something you'd like to see translated and we'll check it out.
55 |
56 | Q: Who are you?
57 | A: I'm Matt Epler (http://mepler.com). I'm a graduate student at NYU's Interactive Telecommunications Program and this is a side project I find interesting.
58 |
59 | Q: Why aren't you using Processing.js?
60 | A: Processing.js doesn't include all the functions available in regular Processing. We would like people to have access to all of those beautiful functions. If, however, you prefer to make something that can run in a browser we welcome that and will do our best to make it look right on our site.
61 |
62 |
--------------------------------------------------------------------------------
/benjamin_fox/vol2no4cover/lines.pde:
--------------------------------------------------------------------------------
1 | void drawLines(int l) {
2 | //lets randomise the order of lines to draw
3 | Collections.shuffle(lines);
4 |
5 | for (int j = 0; j < l; j++) {
6 |
7 | int i = (Integer) lines.get(j);
8 |
9 | switch (i) {
10 | case 1:
11 | line(0, 0, tileSize, tileSize);
12 | break;
13 | case 2:
14 | line(0, tileSize, tileSize, 0);
15 | break;
16 | case 3:
17 | line(0, tileSize/2, tileSize, tileSize/2);
18 | break;
19 | case 4:
20 | line(tileSize/2, 0, tileSize/2, tileSize);
21 | break;
22 | case 5:
23 | line(0, tileSize/2, tileSize/2, 0);
24 | break;
25 | case 6:
26 | line(tileSize/2, 0, tileSize, tileSize/2);
27 | break;
28 | case 7:
29 | line(tileSize, tileSize/2, tileSize/2, tileSize);
30 | break;
31 | case 8:
32 | line(tileSize/2, tileSize, 0, tileSize/2);
33 | break;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/benjamin_fox/vol2no4cover/tile.pde:
--------------------------------------------------------------------------------
1 | void tile(int col, int row, int maxLines, int reducer) {
2 |
3 | pushMatrix();
4 | translate(col * n * tileSize, row * n * tileSize);
5 |
6 | for (int i = 0; i < numTiles; i++) {
7 | int c = i % n;
8 | int r = i / n;
9 |
10 | int numLines = maxLines - (reducer * max(abs(r - centerTile), abs(c - centerTile)));
11 |
12 | pushMatrix();
13 | translate(c * tileSize, r * tileSize);
14 | drawLines(numLines);
15 |
16 | popMatrix();
17 | }
18 |
19 | popMatrix();
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/benjamin_fox/vol2no4cover/vol2no4cover.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol2 no4 cover
3 | // by Roger Coqart
4 | // "From the Square Series"
5 | //
6 | // Benjamin Fox
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | int margin = 40;
11 |
12 | //specify rows & cols of grid on screen
13 | int screenRows = 3;
14 | int screenCols = 3;
15 | int numScreenCells = screenRows * screenCols;
16 |
17 | //specify rows & cols of a grid of tiles
18 | int n = 7;//we're defining as a single var as we want it square
19 | int tileSize = 35;// w / h of the lined tile
20 | int numTiles = n * n;
21 | int centerTile = n/2;
22 |
23 | ArrayList lines;
24 |
25 | void setup() {
26 | //set screen size
27 | int sW = screenRows * n * tileSize + margin;
28 | int sH = screenCols * n * tileSize + margin;
29 | size(sW, sH);
30 |
31 | //for use later when randomising the lines to draw
32 | lines = new ArrayList();
33 | for (int i = 1; i <= 8; i++) {
34 | lines.add((int) i);
35 | }
36 | }
37 |
38 | void draw() {
39 | stroke(255);
40 | strokeWeight(2);
41 | background(0);
42 |
43 | pushMatrix();
44 | translate(margin/2, margin/2);
45 |
46 | for (int i = 0; i < numScreenCells; i++) {
47 | int x = i % screenRows;
48 | int y = i / screenCols;
49 |
50 | //decides on the density of tiles for the cell we are filling
51 | if (i % 2 == 0) {
52 | tile(x, y, 8, 2);//max 8 lines per tile, reducing by 2 from center
53 | } else {
54 | tile(x, y, 4, 1);//max 4 lines per tile, reducing by 1 from center
55 | }
56 | }
57 |
58 | popMatrix();
59 |
60 | noLoop();
61 | }
62 |
63 | void mouseReleased() {
64 | loop();
65 | }
66 |
--------------------------------------------------------------------------------
/calvin_hu/P210/P210.pde:
--------------------------------------------------------------------------------
1 | int screenHeight = 960;
2 | int screenWidth = 960;
3 | int offset = 30;
4 | int interval = 300;
5 | int cubeSide = 100;
6 |
7 | void draw_cube(int slength, boolean[] permutation, int strokeCube, int strokeOutline) {
8 | int side = slength/2;
9 | int start_point = -side;
10 | int dHeight = 2;
11 | int dWidth = 125;
12 | if (permutation[0]) {
13 | strokeWeight(strokeOutline);
14 | line(start_point, start_point + dHeight, start_point - dWidth, start_point, start_point + dHeight, side + dWidth);
15 | line(start_point, start_point - dHeight, start_point - dWidth, start_point, start_point - dHeight, side + dWidth);
16 |
17 | line(side, start_point + dHeight, start_point - dWidth, side, start_point + dHeight, side + dWidth);
18 | line(side, start_point - dHeight, start_point - dWidth, side, start_point - dHeight, side + dWidth);
19 |
20 | line(side, side + dHeight, start_point - dWidth, side, side + dHeight, side + dWidth);
21 | line(side, side - dHeight, start_point - dWidth, side, side - dHeight, side + dWidth);
22 |
23 | line(start_point, side + dHeight, start_point - dWidth, start_point, side + dHeight, side + dWidth);
24 | line(start_point, side - dHeight, start_point - dWidth, start_point, side - dHeight, side + dWidth);
25 |
26 | strokeWeight(strokeCube);
27 | line(side, side, start_point, side, side, side);
28 | line(side, start_point, start_point, side, start_point, side);
29 | line(start_point, start_point, start_point, start_point, start_point, side);
30 | line(start_point, side, start_point, start_point, side, side);
31 | }
32 | if (permutation[1]) {
33 | strokeWeight(strokeOutline);
34 | line(start_point + dHeight, start_point - dWidth, start_point, start_point + dHeight, side + dWidth, start_point);
35 | line(start_point - dHeight, start_point - dWidth, start_point, start_point - dHeight, side + dWidth, start_point);
36 |
37 | line(start_point + dHeight, start_point - dWidth, side, start_point + dHeight, side + dWidth, side);
38 | line(start_point - dHeight, start_point - dWidth, side, start_point - dHeight, side + dWidth, side);
39 |
40 | line(side + dHeight, start_point - dWidth, start_point, side + dHeight, side + dWidth, start_point);
41 | line(side - dHeight, start_point - dWidth, start_point, side - dHeight, side + dWidth, start_point);
42 |
43 | line(side + dHeight, start_point - dWidth, side, side + dHeight, side + dWidth, side);
44 | line(side - dHeight, start_point - dWidth, side, side - dHeight, side + dWidth, side);
45 | strokeWeight(strokeCube);
46 | line(start_point, start_point, start_point, start_point, side, start_point);
47 | line(start_point, start_point, side, start_point, side, side);
48 | line(side, start_point, start_point, side, side, start_point);
49 | line(side, start_point, side, side, side, side);
50 | }
51 | if (permutation[2]) {
52 | strokeWeight(strokeOutline);
53 | line(start_point - dWidth, start_point + dHeight, start_point, side + dWidth, start_point + dHeight, start_point);
54 | line(start_point - dWidth, start_point - dHeight, start_point, side + dWidth, start_point - dHeight, start_point);
55 |
56 | line(start_point - dWidth, start_point + dHeight, side, side + dWidth, start_point + dHeight, side);
57 | line(start_point - dWidth, start_point - dHeight, side, side + dWidth, start_point - dHeight, side);
58 |
59 | line(start_point - dWidth, side + dHeight, start_point, side + dWidth, side + dHeight, start_point);
60 | line(start_point - dWidth, side - dHeight, start_point, side + dWidth, side - dHeight, start_point);
61 |
62 | line(start_point - dWidth, side + dHeight, side, side + dWidth, side + dHeight, side);
63 | line(start_point - dWidth, side - dHeight, side, side + dWidth, side - dHeight, side);
64 | strokeWeight(strokeCube);
65 | line(start_point, start_point, start_point, side, start_point, start_point);
66 | line(start_point, start_point, side, side, start_point, side);
67 | line(start_point, side, start_point, side, side, start_point);
68 | line(start_point, side, side, side, side, side);
69 | }
70 | }
71 |
72 | void setup() {
73 | size(screenWidth, screenHeight, P3D);
74 | background(255);
75 | //fill(255);
76 | rectMode(CORNERS);
77 | ortho();
78 | noLoop();
79 | }
80 |
81 | void draw() {
82 | pushMatrix();
83 | translate(offset-interval/2, offset-interval/2);
84 |
85 | boolean[] sides;
86 | for (int i = 0; i < 3; i++) {
87 | translate(interval, 0);
88 | pushMatrix();
89 | for (int j = 1; j <= 3; j++) {
90 | boolean[] refreshSides = {
91 | false, false, false
92 | };
93 | sides = refreshSides;
94 | translate(0, interval);
95 | if (j != 1) {
96 | for (int k = 1; k < j + 1; k++) {
97 | sides[(i + k) % 3] = true;
98 | }
99 | }
100 | else {
101 | sides[i] = true;
102 | }
103 | pushMatrix();
104 | rotateX(PI * 3/16);
105 | rotateY(PI * 3/10);
106 | rotateZ(PI/12);
107 | draw_cube(cubeSide, sides, 3, 1);
108 | popMatrix();
109 | }
110 | popMatrix();
111 | }
112 | popMatrix();
113 |
114 | hint(DISABLE_DEPTH_TEST);
115 | noStroke();
116 | fill(255);
117 | for (int i = 0; i < 4; i++) {
118 | rect(0, i * interval, screenWidth, i * interval + offset*2);
119 | rect(i * interval, 0, i * interval + offset * 2, screenHeight);
120 | }
121 |
122 | strokeWeight(1);
123 | stroke(0);
124 | for (int i = 1; i <= 2; i++) {
125 | line(offset, offset + i*interval, screenWidth - offset, offset + i*interval);
126 | line(offset + i*interval, offset, offset + i*interval, screenHeight - offset);
127 | }
128 | save("P210 A Part 1.png");
129 | }
130 |
131 |
--------------------------------------------------------------------------------
/calvin_hu/cubelimitseries/cubelimitseries.pde:
--------------------------------------------------------------------------------
1 | /*
2 | This sketch is part of the ReCode Project - http://recodeproject.com
3 | From Computer Graphics and Art vol1 no2 pg 14
4 | by Manfred Mhor
5 | "The Cubic Limit Series"
6 |
7 | Calvin Hu
8 | 2012
9 | Creative Commons license CC BY-SA 3.0
10 | */
11 |
12 | int offset = 30;
13 | int interval = 30;
14 | int[] bitPositions = {0, 1, 2, 3, 4, 5, 12};
15 | boolean[] permutation = {true,true,true,true,true,true,false,false,false,false,false,false};
16 |
17 | void draw_cube(int slength, boolean[] permutation){
18 | int side = slength/2;
19 | int start_point = -side;
20 | if(permutation[0])
21 | line(start_point, start_point, start_point, start_point, start_point, side);
22 | if(permutation[1])
23 | line(start_point, start_point, start_point, start_point, side, start_point);
24 | if(permutation[2])
25 | line(start_point, start_point, start_point, side, start_point, start_point);
26 | if(permutation[3])
27 | line(start_point, start_point, side, start_point, side, side);
28 | if(permutation[4])
29 | line(start_point, start_point, side, side, start_point, side);
30 | if(permutation[5])
31 | line(start_point, side, start_point, side, side, start_point);
32 | if(permutation[6])
33 | line(start_point, side, start_point, start_point, side, side);
34 | if(permutation[7])
35 | line(side, start_point, start_point, side, side, start_point);
36 | if(permutation[8])
37 | line(side, start_point, start_point, side, start_point, side);
38 | if(permutation[9])
39 | line(side, side, start_point, side, side, side);
40 | if(permutation[10])
41 | line(side, start_point, side, side, side, side);
42 | if(permutation[11])
43 | line(start_point, side, side, side, side, side);
44 | }
45 |
46 | boolean[] swap_boolean_array(boolean[] boolArr, int indexFrom, int indexTo){
47 | boolean temp = boolArr[indexTo];
48 | boolArr[indexTo] = boolArr[indexFrom];
49 | boolArr[indexFrom] = temp;
50 | return boolArr;
51 | }
52 |
53 | boolean nextPermutation(){
54 | for(int i = 5; i >= 0; i--){
55 | if(bitPositions[i] + 1 < bitPositions[i + 1]){
56 | permutation = swap_boolean_array(permutation, bitPositions[i], ++bitPositions[i]);
57 | if(i < 5){
58 | for(int j = i + 1 ; j < 6; j++){
59 | permutation = swap_boolean_array(permutation, bitPositions[j], bitPositions[j - 1] + 1);
60 | bitPositions[j] = bitPositions[j - 1] + 1;
61 | }
62 | }
63 | return true;
64 | }
65 | }
66 | return false;
67 | }
68 |
69 | void setup(){
70 | size(990, 990, P3D);
71 | ortho();
72 | background(0);
73 | noFill();
74 | stroke(255);
75 | for(int i = 0; i < 32; i++){
76 | int columnX = offset + i * interval;
77 | line(columnX, offset, columnX, height - offset);
78 | }
79 | for(int i = 0; i < 32; i++){
80 | int rowY = offset + i * interval;
81 | line(offset, rowY, width - offset, rowY);
82 | }
83 |
84 |
85 | boolean anyPermsLeft = true;
86 | pushMatrix();
87 | translate(32 * interval + offset/2, offset/2);
88 | for(int i = 0; i < 31 & anyPermsLeft; i++){
89 | translate(-interval, 0);
90 | pushMatrix();
91 | for(int j = 0; j < 31 & anyPermsLeft; j++){
92 | translate(0, interval);
93 | pushMatrix();
94 | rotateX(PI * 5/6);
95 | rotateY(PI * -5/6);
96 | draw_cube(15, permutation);
97 | anyPermsLeft = nextPermutation();
98 | popMatrix();
99 | }
100 | popMatrix();
101 | }
102 | popMatrix();
103 | }
104 |
105 | void draw(){
106 | }
107 |
--------------------------------------------------------------------------------
/calvin_hu/cubelimitseries_rotation/cubelimitseries_rotation.pde:
--------------------------------------------------------------------------------
1 | /*
2 | This sketch is part of the ReCode Project - http://recodeproject.com
3 | From Computer Graphics and Art vol1 no2 pg 14
4 | by Manfred Mhor
5 | "The Cubic Limit Series"
6 |
7 | Calvin Hu
8 | 2012
9 | Creative Commons license CC BY-SA 3.0
10 | */
11 |
12 | int offset = 30;
13 | int interval = 30;
14 | int[] bitPositions;
15 | boolean[] permutation;
16 |
17 | float rotateXAngle, rotateYAngle, rotateZAngle;
18 |
19 | void draw_cube(int slength, boolean[] permutation){
20 | int side = slength/2;
21 | int start_point = -side;
22 | if(permutation[0])
23 | line(start_point, start_point, start_point, start_point, start_point, side);
24 | if(permutation[1])
25 | line(start_point, start_point, start_point, start_point, side, start_point);
26 | if(permutation[2])
27 | line(start_point, start_point, start_point, side, start_point, start_point);
28 | if(permutation[3])
29 | line(start_point, start_point, side, start_point, side, side);
30 | if(permutation[4])
31 | line(start_point, start_point, side, side, start_point, side);
32 | if(permutation[5])
33 | line(start_point, side, start_point, side, side, start_point);
34 | if(permutation[6])
35 | line(start_point, side, start_point, start_point, side, side);
36 | if(permutation[7])
37 | line(side, start_point, start_point, side, side, start_point);
38 | if(permutation[8])
39 | line(side, start_point, start_point, side, start_point, side);
40 | if(permutation[9])
41 | line(side, side, start_point, side, side, side);
42 | if(permutation[10])
43 | line(side, start_point, side, side, side, side);
44 | if(permutation[11])
45 | line(start_point, side, side, side, side, side);
46 | }
47 |
48 | boolean[] swap_boolean_array(boolean[] boolArr, int indexFrom, int indexTo){
49 | boolean temp = boolArr[indexTo];
50 | boolArr[indexTo] = boolArr[indexFrom];
51 | boolArr[indexFrom] = temp;
52 | return boolArr;
53 | }
54 |
55 | boolean nextPermutation(){
56 | for(int i = 5; i >= 0; i--){
57 | if(bitPositions[i] + 1 < bitPositions[i + 1]){
58 | permutation = swap_boolean_array(permutation, bitPositions[i], ++bitPositions[i]);
59 | if(i < 5){
60 | for(int j = i + 1 ; j < 6; j++){
61 | permutation = swap_boolean_array(permutation, bitPositions[j], bitPositions[j - 1] + 1);
62 | bitPositions[j] = bitPositions[j - 1] + 1;
63 | }
64 | }
65 | return true;
66 | }
67 | }
68 | return false;
69 | }
70 |
71 | void setup(){
72 | size(990, 990, P3D);
73 | ortho();
74 | background(0);
75 | noFill();
76 | stroke(255);
77 | frameRate(8);
78 |
79 | rotateXAngle = PI * 5/6;
80 | rotateYAngle = PI * -5/6;
81 | rotateZAngle = 0;
82 | }
83 |
84 | void draw(){
85 | boolean[] newPermutation = {true,true,true,true,true,true,false,false,false,false,false,false};
86 | int[] newBitPositions = {0, 1, 2, 3, 4, 5, 12};
87 | permutation = newPermutation;
88 | bitPositions = newBitPositions;
89 | background(0);
90 | for(int i = 0; i < 32; i++){
91 | int columnX = offset + i * interval;
92 | line(columnX, offset, columnX, height - offset);
93 | }
94 | for(int i = 0; i < 32; i++){
95 | int rowY = offset + i * interval;
96 | line(offset, rowY, width - offset, rowY);
97 | }
98 |
99 | boolean anyPermsLeft = true;
100 | pushMatrix();
101 | translate(32 * interval + offset/2, offset/2);
102 | for(int i = 0; i < 31 & anyPermsLeft; i++){
103 | translate(-interval, 0);
104 | pushMatrix();
105 | for(int j = 0; j < 31 & anyPermsLeft; j++){
106 | translate(0, interval);
107 | pushMatrix();
108 | rotateX(rotateXAngle);
109 | rotateY(rotateYAngle);
110 | rotateZ(rotateZAngle);
111 | draw_cube(15, permutation);
112 | anyPermsLeft = nextPermutation();
113 | popMatrix();
114 | }
115 | popMatrix();
116 | }
117 | popMatrix();
118 | rotateXAngle += PI/60;
119 | rotateYAngle += PI/60;
120 | rotateZAngle += PI/60;
121 | }
122 |
--------------------------------------------------------------------------------
/chris_allick/GeorgNeesUntitled18/GeorgNeesUntitled18.pde:
--------------------------------------------------------------------------------
1 | int radius = 150;
2 | int min, max;
3 |
4 | void setup() {
5 | size( 600, 600 );
6 | background( 255 );
7 | stroke( 0 );
8 | noFill();
9 | strokeWeight( 2 );
10 | min = 100;
11 | max = 300;
12 | drawCircles();
13 | }
14 |
15 | void draw() {}
16 |
17 | void drawCircles() {
18 | background( 255 );
19 |
20 | for( int r = 0; r < 2; r++ ) {
21 | for( int c = 0; c < 2; c++ ) {
22 | pushMatrix();
23 | translate( 150+(300*r), 150+(300*c));
24 | //ellipse( 0, 0, 300, 300 );
25 | for( int i = 0; i < (int)random(min,max); i++ ) {
26 | float a = random(0, TWO_PI);
27 | float x1 = radius*cos(a);
28 | float y1 = radius*sin(a);
29 | a = random(0, TWO_PI);
30 | float x2 = radius*cos(a);
31 | float y2 = radius*sin(a);
32 |
33 | line( x1, y1, x2, y2);
34 | }
35 | popMatrix();
36 | }
37 | }
38 | }
39 |
40 | void mousePressed() {
41 | drawCircles();
42 | }
43 |
--------------------------------------------------------------------------------
/chris_allick/JeanClaudeMarquette/JeanClaudeMarquette.pde:
--------------------------------------------------------------------------------
1 | PGraphics pg;
2 |
3 | void setup() {
4 | size( 416, 500, OPENGL );
5 | fill( 0 );
6 | noStroke();
7 | pg = createGraphics( 416, 500, OPENGL );
8 |
9 | drawSquares();
10 | }
11 |
12 | void draw() {
13 | }
14 |
15 | void drawSquares() {
16 | background( 240 );
17 | pg.beginDraw();
18 | pg.background( 240 );
19 | for( int r = 2; r < 15; r++ ) {
20 | for( int c = 0; c < 28; c++ ) {
21 | int rand = (int)round(random(0,1));
22 | pg.noStroke();
23 | if( rand == 1 ) {
24 | pg.fill( 63 );
25 | } else {
26 | pg.noFill();
27 | }
28 | pg.rect( r*26, c*26, 26, 26 );
29 | }
30 | }
31 | pg.endDraw();
32 | rotate(-0.01);
33 | translate( -8, 0, 0 );
34 | image(pg, 0, 0);
35 | }
36 |
37 | void mousePressed() {
38 | drawSquares();
39 | }
40 |
--------------------------------------------------------------------------------
/chris_allick/RandomSquares/RandomSquares.pde:
--------------------------------------------------------------------------------
1 |
2 | void setup() {
3 | size( 400, 400);
4 | background( 255 );
5 | stroke( 0 );
6 | strokeWeight( 2 );
7 | noFill();
8 | smooth();
9 | drawRects();
10 | }
11 |
12 | void draw() {
13 |
14 | }
15 |
16 | void drawRects() {
17 | background(255);
18 | for( int i = 0; i < 400; i++ ) {
19 | roundedRect( random(-10,width), random(-10,height), random( 5, 40), random(5,40), 5, 5 );
20 | }
21 | }
22 |
23 | void mousePressed() {
24 | drawRects();
25 | }
26 |
27 | void roundedRect(float x, float y, float w, float h, float rx, float ry) { //Code adapted from "cefnhoile", heres the link: https://forum.processing.org/topic/rounded-rectangle .
28 | beginShape();
29 | vertex(x, y+ry); //top of left side
30 | bezierVertex(x, y, x, y, x+rx, y); //top left corner
31 |
32 | vertex(x+w-rx, y); //right of top side
33 | bezierVertex(x+w, y, x+w, y, x+w, y+ry); //top right corner
34 |
35 | vertex(x+w, y+h-ry); //bottom of right side
36 | bezierVertex(x+w, y+h, x+w, y+h, x+w-rx, y+h); //bottom right corner
37 |
38 | vertex(x+rx, y+h); //left of bottom side
39 | bezierVertex(x, y+h, x, y+h, x, y+h-ry); //bottom left corner
40 |
41 | endShape(CLOSE);
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/chris_allick/Untitled1/Untitled1.pde:
--------------------------------------------------------------------------------
1 |
2 | int num = 5;
3 | int depth = 6;
4 |
5 | ArrayList rects;
6 |
7 | void setup() {
8 | size( 500, 500 );
9 | fill( 255 );
10 | stroke( 0 );
11 | strokeWeight( 2 );
12 | rects = new ArrayList();
13 | createRects();
14 | frameRate(10);
15 | }
16 |
17 | void draw() {
18 | background( 255 );
19 |
20 | for( int i = 0; i < rects.size(); i++ ) {
21 | Rect rect = (Rect) rects.get(i);
22 | rect.update();
23 | rect.display();
24 | }
25 | }
26 |
27 | void createRects() {
28 | for ( int r = 0; r < num; r++ ) {
29 | for ( int c = 0; c < num; c++ ) {
30 | rects.add(new Rect( r*100, c*100, 100, 100, depth ) );
31 | }
32 | }
33 | }
34 |
35 | class Rect {
36 | int w, h, d;
37 |
38 | float x, y, xoff, yoff, xd, yd;
39 |
40 | Rect( float _x, float _y, int _w, int _h, int _d ) {
41 | x = _x;
42 | y = _y;
43 | w = _w;
44 | h = _h;
45 | d = _d;
46 |
47 | xoff = (int)random(2,20);
48 | yoff = (int)random(2,10);
49 |
50 | xd = random(-1,1);
51 | yd = random(-1,1);
52 | }
53 |
54 | void update() {
55 | xoff += xd;
56 | yoff -= yd;
57 |
58 | if( xoff > 18 || xoff < 2 ) {
59 | xd = -xd;
60 | }
61 |
62 | if( yoff > 18 || yoff < 2 ) {
63 | yd = -yd;
64 | }
65 | }
66 |
67 | void display() {
68 | stroke( 0 );
69 | fill( 255 );
70 | for( int i = 0; i < d; i++ ) {
71 | rect( x+(xoff*i), y+(yoff*i), w-(20*i), h-(20*i) );
72 | }
73 | }
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/daniel_howe/RasterWalk/.gitignore:
--------------------------------------------------------------------------------
1 | processing-min.js
2 |
--------------------------------------------------------------------------------
/daniel_howe/RasterWalk/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | RasterWalk : ReCode
9 |
10 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | /**
37 | * Recode of "Random Walk Through Raster" by Frieder Nake, 1966
38 | *
39 | * from Computer Graphics and Art - May, 1976 Vol. 1, No. 4 Pg 6-7
40 | *
41 | * included in the ReCode Project - http://recodeproject.com
42 | *
43 | * Copyright (c) 2012 Daniel C. Howe
44 | */
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | Source code: RasterWalk.js
55 |
56 |
57 |
58 | Built with ProcessingJS
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/daniel_howe/RasterWalk/rasterwalk.js:
--------------------------------------------------------------------------------
1 | /**
2 | * This sketch is part of the ReCode Project - http://recodeproject.com
3 | *
4 | * Computer Graphics and Art - May, 1976 - Vol. 1, No. 4 - Pg 6-7
5 | *
6 | * "Random Walk Through Raster" by Frieder Nake, 1966
7 | *
8 | * direct recode by Daniel C. Howe
9 | *
10 | * Copyright (c) 2012 Daniel C. Howe
11 | *
12 | * Permission is hereby granted, free of charge, to any person
13 | * obtaining a copy of this software and associated documentation
14 | * files (the "Software"), to deal in the Software without
15 | * restriction, including without limitation the rights to use,
16 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
17 | * copies of the Software, and to permit persons to whom the
18 | * Software is furnished to do so, subject to the following
19 | * conditions:
20 |
21 | * The above copyright notice and this permission notice shall be
22 | * included in all copies or substantial portions of the Software.
23 |
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYR
28 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 | * OTHER DEALINGS IN THE SOFTWARE.
32 | */
33 |
34 | var x=50, y=50, cellSz, grid=[];
35 | var D=1, R=2, px=0, py=0, sw=2;
36 |
37 | void setup() {
38 |
39 | size(400,400);
40 |
41 | background(255);
42 | noFill();
43 | strokeWeight(sw);
44 | strokeCap(PROJECT);
45 |
46 | initializeGrid();
47 | foreach(drawCell);
48 |
49 | step(); // until done
50 | }
51 |
52 | // JS functions
53 |
54 | function drawCell(j,i) {
55 |
56 | // skip one row/col around edge
57 | if (i > 0 && j < y-1 && i < y-1 && i < x-1 && j < x-1) {
58 |
59 | var off = 0;
60 | stroke(0);
61 | if (!exists(j, i, D)) { // edge below
62 | stroke(255); // erase
63 | if (j > 1) off = sw;
64 | }
65 |
66 | if (j > 0) {
67 | line(j * cellSz + off, cellSz + i * cellSz, // horiz
68 | (j + 1) * cellSz-1, cellSz +(i * cellSz));
69 | }
70 |
71 | off = 0;
72 | stroke(0);
73 | if (!exists(j, i, R)) { // edge to right
74 | stroke(255); // erase
75 | if (i > 1) off = sw;
76 | }
77 |
78 | line((cellSz + j * cellSz), i * cellSz + off, // vert
79 | (cellSz + j * cellSz), (i + 1) * cellSz-1);
80 | }
81 | }
82 |
83 | function initializeGrid() {
84 |
85 | cellSz = min(width,height) / x;
86 |
87 | for (var j = 0; j < x+1; j++) {
88 |
89 | grid[j] = []; // initialize to 0
90 | for (var i = 0; i < y+1; i++)
91 | grid[j][i] = 0;
92 | }
93 | }
94 |
95 | function step() {
96 |
97 | var dirs = (Math.random() < .9) ? [D] : [R,D];
98 | var dir = dirs[floor(random(dirs.length))];
99 | remove(px, py, dir);
100 |
101 | // weight verticals and the diagonal
102 | var d = dist(px,0,py,0) / x;
103 | if (Math.random() < d)
104 | remove(px, py, R);
105 |
106 | drawCell(px,py);
107 |
108 | if (++px % x == 0) { px = 0; ++py; }
109 |
110 | if (py < y-1 || px < x-1)
111 | setTimeout(step, 0);
112 | }
113 |
114 | function foreach(fun) {
115 |
116 | for (var i = 0; i < y; i++) {
117 | for (var j = 0; j < x; j++)
118 | fun.apply(this,[j,i]);
119 | }
120 | }
121 |
122 | function exists(j,i,side) {
123 |
124 | switch(side) {
125 | case R: return (grid[j][i] < 2);
126 | case D: return (grid[j][i] % 2==0);
127 | }
128 | }
129 |
130 | function remove(j,i,side) {
131 |
132 | if (exists(j,i,side))
133 | grid[j][i] += side;
134 | }
135 |
--------------------------------------------------------------------------------
/daniel_howe/VoronoiRecode/Delaunay.pde:
--------------------------------------------------------------------------------
1 | /*
2 | * A port to Processing of
3 | * Marcus Appel's
4 | * 'Delaunay Triangulation' routines
5 | */
6 | class Delaunay {
7 |
8 | public Delaunay(int num) {
9 | tris = new ArrayList();
10 | nodes = new ArrayList();
11 | edges = new ArrayList();
12 | for (int i = 0; i < num; i++)
13 | insert((int) random(width/4, width*.75), (int) random(height/4, height*.75));
14 | }
15 |
16 | public void clear() {
17 | nodes.clear();
18 | edges.clear();
19 | tris.clear();
20 | }
21 |
22 | public void insert(int px, int py) {
23 | int eid;
24 | Node nd = new Node(px, py);
25 | nodes.add(nd);
26 | if (nodes.size() < 3)
27 | return;
28 | if (nodes.size() == 3) // create the first tri
29 | {
30 | Node p1 = nodeAt(0), p2 = nodeAt(1), p3 = nodeAt(2);
31 | Edge e1 = new Edge(p1, p2);
32 | if (e1.onSide(p3) == 0) {
33 | nodes.remove(nd);
34 | return;
35 | }
36 | if (e1.onSide(p3) == -1) // right side
37 | {
38 | p1 = (Node) nodes.get(1);
39 | p2 = (Node) nodes.get(0);
40 | e1.updateEdge(p1, p2);
41 | }
42 | Edge e2 = new Edge(p2, p3), e3 = new Edge(p3, p1);
43 | e1.setNextH(e2);
44 | e2.setNextH(e3);
45 | e3.setNextH(e1);
46 | hullStart = e1;
47 | tris.add(new Triangle(edges, e1, e2, e3));
48 | return;
49 | }
50 | actE = (Edge) edges.get(0);
51 | if (actE.onSide(nd) == -1) {
52 | if (actE.invE == null)
53 | eid = -1;
54 | else
55 | eid = searchEdge(actE.invE, nd);
56 | }
57 | else
58 | eid = searchEdge(actE, nd);
59 | if (eid == 0) {
60 | nodes.remove(nd);
61 | return;
62 | }
63 | if (eid > 0)
64 | expandTri(actE, nd, eid); // nd is inside or on a triangle
65 | else
66 | expandHull(nd); // nd is outside convex hull
67 | }
68 |
69 | public void delete(int px, int py) {
70 |
71 | if (nodes.size() <= 3) return; // not for single tri
72 |
73 | Node nd = nearest(px, py);
74 | if (nd == null)
75 | return; // not found
76 | nodes.remove(nd);
77 | Edge e, ee, start;
78 | start = e = nd.anEdge.mostRight();
79 | int nodetype = 0, idegree = -1;
80 |
81 | if (edges==null || index.length < edges.size())
82 | index = new Edge[(edges==null?0:edges.size()) + 100];
83 |
84 | while (nodetype == 0) {
85 | edges.remove(ee = e.nextE);
86 | index[++idegree] = ee;
87 | ee.asIndex();
88 | tris.remove(e.inT); // delete triangles involved
89 | edges.remove(e);
90 | edges.remove(ee.nextE);
91 | e = ee.nextE.invE; // next left edge
92 | if (e == null) nodetype = 2; // nd on convex hull
93 | if (e == start) nodetype = 1; // inner node
94 | }
95 |
96 | // generate new tris and add to triangulation
97 | int cur_i = 0, cur_n = 0;
98 | int last_n = idegree;
99 | Edge e1 = null, e2 = null, e3;
100 | while (last_n >= 1) {
101 | e1 = index[cur_i];
102 | e2 = index[cur_i + 1];
103 | if (last_n == 2 && nodetype == 1) {
104 | tris.add(new Triangle(edges, e1, e2, index[2]));
105 | swapTest(e1, e2, index[2]); // no varargs in pjs
106 | break;
107 | }
108 | if (last_n == 1 && nodetype == 1) {
109 | index[0].invE.rinkSymm(index[1].invE);
110 | index[0].invE.asIndex();
111 | index[1].invE.asIndex();
112 | swapTest(index[0].invE);
113 | break;
114 | }
115 | if (e1.onSide(e2.p2) == 1) // left side
116 | {
117 | e3 = new Edge(e2.p2, e1.p1);
118 | cur_i += 2;
119 | index[cur_n++] = e3.makeSymm();
120 | tris.add(new Triangle(edges, e1, e2, e3));
121 | swapTest(e1, e2);
122 | }
123 | else
124 | index[cur_n++] = index[cur_i++];
125 |
126 | if (cur_i == last_n)
127 | index[cur_n++] = index[cur_i++];
128 |
129 | if (cur_i == last_n + 1) {
130 | if (last_n == cur_n - 1)
131 | break;
132 | last_n = cur_n - 1;
133 | cur_i = cur_n = 0;
134 | }
135 | }
136 | if (nodetype == 2) // reconstruct convex hull
137 | {
138 | index[last_n].invE.mostLeft().setNextH(hullStart = index[last_n].invE);
139 | for (int i = last_n; i > 0; i--) {
140 | index[i].invE.setNextH(index[i - 1].invE);
141 | index[i].invE.setInvE(null);
142 | }
143 | index[0].invE.setNextH(start.nextH);
144 | index[0].invE.setInvE(null);
145 | }
146 | }
147 |
148 | void expandTri(Edge e, Node nd, int type) {
149 | Edge e1 = e, e2 = e1.nextE, e3 = e2.nextE;
150 | Node p1 = e1.p1, p2 = e2.p1, p3 = e3.p1;
151 |
152 | if (type == 2) {// nd is inside of the triangle
153 |
154 | Edge e10 = new Edge(p1, nd), e20 = new Edge(p2, nd), e30 = new Edge(p3, nd);
155 | e.inT.removeEdges(edges);
156 | tris.remove(e.inT); // remove old triangle
157 | tris.add(new Triangle(edges, e1, e20, e10.makeSymm()));
158 | tris.add(new Triangle(edges, e2, e30, e20.makeSymm()));
159 | tris.add(new Triangle(edges, e3, e10, e30.makeSymm()));
160 | swapTest(e1, e2, e3); // swap test for the three new triangles
161 | }
162 | else {// nd is on the edge e
163 |
164 | Edge e4 = e1.invE;
165 | if (e4 == null || e4.inT == null) // one triangle involved
166 | {
167 | Edge e30 = new Edge(p3, nd), e02 = new Edge(nd, p2),
168 | e10 = new Edge(p1, nd), e03 = e30.makeSymm();
169 | e10.asIndex();
170 | e1.mostLeft().setNextH(e10);
171 | e10.setNextH(e02);
172 | e02.setNextH(e1.nextH);
173 | hullStart = e02;
174 | tris.remove(e1.inT); // remove oldtriangle
175 | edges.remove(e1);
176 | edges.add(e10);// add two new triangles
177 | edges.add(e02);
178 | edges.add(e30);
179 | edges.add(e03);
180 | tris.add(new Triangle(e2, e30, e02));
181 | tris.add(new Triangle(e3, e10, e03));
182 | swapTest(e2, e3, e30); // swap test for the two new triangles
183 | }
184 | else // two triangle involved
185 | {
186 | Edge e5 = e4.nextE, e6 = e5.nextE;
187 | Node p4 = e6.p1;
188 | Edge e10 = new Edge(p1, nd), e20 = new Edge(p2, nd),
189 | e30 = new Edge(p3, nd), e40 = new Edge(p4, nd);
190 | tris.remove(e.inT); // remove oldtriangle
191 | e.inT.removeEdges(edges);
192 | tris.remove(e4.inT); // remove old triangle
193 | e4.inT.removeEdges(edges);
194 | e5.asIndex();
195 | e2.asIndex();
196 | tris.add(new Triangle(edges, e2, e30, e20.makeSymm()));
197 | tris.add(new Triangle(edges, e3, e10, e30.makeSymm()));
198 | tris.add(new Triangle(edges, e5, e40, e10.makeSymm()));
199 | tris.add(new Triangle(edges, e6, e20, e40.makeSymm()));
200 | swapTest(e2, e3, e5, e6, e10, e20, e30, e40); // no varargs in pjs
201 | }
202 | }
203 | }
204 |
205 | void expandHull(Node nd) {
206 | Edge e1, e2, e3 = null, enext, e = hullStart, comedge = null, lastbe = null;
207 | while (true) {
208 | enext = e.nextH;
209 | if (e.onSide(nd) == -1) // right side
210 | {
211 | if (lastbe != null) {
212 | e1 = e.makeSymm();
213 | e2 = new Edge(e.p1, nd);
214 | e3 = new Edge(nd, e.p2);
215 | if (comedge == null) {
216 | hullStart = lastbe;
217 | lastbe.setNextH(e2);
218 | lastbe = e2;
219 | }
220 | else
221 | comedge.rinkSymm(e2);
222 | comedge = e3;
223 | tris.add(new Triangle(edges, e1, e2, e3));
224 | swapTest(e);
225 | }
226 | }
227 | else {
228 | if (comedge != null) break;
229 | lastbe = e;
230 | }
231 | e = enext;
232 | }
233 |
234 | lastbe.setNextH(e3);
235 | e3.setNextH(e);
236 | }
237 |
238 | int searchEdge(Edge e, Node nd) {
239 | int f2, f3;
240 | Edge e0 = null;
241 | if ((f2 = e.nextE.onSide(nd)) == -1) {
242 | if (e.nextE.invE != null)
243 | return searchEdge(e.nextE.invE, nd);
244 | else {
245 | actE = e;
246 | return -1;
247 | }
248 | }
249 | if (f2 == 0)
250 | e0 = e.nextE;
251 | Edge ee = e.nextE;
252 | if ((f3 = ee.nextE.onSide(nd)) == -1) {
253 | if (ee.nextE.invE != null)
254 | return searchEdge(ee.nextE.invE, nd);
255 | else {
256 | actE = ee.nextE;
257 | return -1;
258 | }
259 | }
260 | if (f3 == 0)
261 | e0 = ee.nextE;
262 | if (e.onSide(nd) == 0)
263 | e0 = e;
264 | if (e0 != null) {
265 | actE = e0;
266 | if (e0.nextE.onSide(nd) == 0) {
267 | actE = e0.nextE;
268 | return 0;
269 | }
270 | if (e0.nextE.nextE.onSide(nd) == 0)
271 | return 0;
272 | return 1;
273 | }
274 | actE = ee;
275 | return 2;
276 | }
277 |
278 | void swapTest(Edge ... e) {
279 | for (int i = 0; i < e.length; i++)
280 | swapTest(e[i]);
281 | }
282 |
283 | void swapTest(Edge e) {
284 | Edge e21 = e.invE;
285 | if (e21 == null || e21.inT == null)
286 | return;
287 | Edge e12 = e.nextE, e13 = e12.nextE, e22 = e21.nextE, e23 = e22.nextE;
288 | if (e.inT.inCircle(e22.p2) || e21.inT.inCircle(e12.p2)) {
289 | e.updateEdge(e22.p2, e12.p2);
290 | e21.updateEdge(e12.p2, e22.p2);
291 | e.rinkSymm(e21);
292 | e13.inT.updateTriangle(e13, e22, e);
293 | e23.inT.updateTriangle(e23, e12, e21);
294 | e12.asIndex();
295 | e22.asIndex();
296 | swapTest(e12);
297 | swapTest(e22);
298 | swapTest(e13);
299 | swapTest(e23);
300 | }
301 | }
302 |
303 | Node nearest(float x, float y) {
304 | // locate a node nearest to (px,py)
305 | float dismin = 0.0f, s;
306 | Node nd = null;
307 | for (int i = 0; i < nodes.size(); i++) {
308 | s = ((Node) nodes.get(i)).distance(x, y);
309 | if (s < dismin || nd == null) {
310 | dismin = s;
311 | nd = (Node) nodes.get(i);
312 | }
313 | }
314 | return nd;
315 | }
316 | }
317 |
318 | class Node {
319 | int x, y;
320 | Edge anEdge; // an edge which start from this node
321 |
322 | public Node(int x, int y) {
323 | this.x = x;
324 | this.y = y;
325 | }
326 |
327 | public float distance(float px, float py) {
328 | return dist(x, y, px, py);
329 | }
330 | }
331 |
332 | class Edge {
333 |
334 | Node p1, p2; // start and end point of the edge
335 | Triangle inT; // triangle containing this edge
336 | float a, b, c; // line equation parameters: aX+bY+c=0
337 | Edge invE, nextE, nextH;
338 |
339 | public Edge(Node p1, Node p2) {
340 | updateEdge(p1, p2);
341 | }
342 |
343 | public void updateEdge(Node p1, Node p2) {
344 | this.p1 = p1;
345 | this.p2 = p2;
346 | setAbc();
347 | asIndex();
348 | }
349 |
350 | void setNextE(Edge e) {
351 | nextE = e;
352 | }
353 |
354 | void setNextH(Edge e) {
355 | nextH = e;
356 | }
357 |
358 | void setTri(Triangle t) {
359 | inT = t;
360 | }
361 |
362 | void setInvE(Edge e) {
363 | invE = e;
364 | }
365 |
366 | Edge makeSymm() {
367 | Edge e = new Edge(p2, p1);
368 | rinkSymm(e);
369 | return e;
370 | }
371 |
372 | void rinkSymm(Edge e) {
373 | this.invE = e;
374 | if (e != null)
375 | e.invE = this;
376 | }
377 |
378 | public int onSide(Node nd) {
379 | float s = a * nd.x + b * nd.y + c;
380 | if (s > 0.0)
381 | return 1;
382 | if (s < 0.0)
383 | return -1;
384 | return 0;
385 | }
386 |
387 | void setAbc() // set parameters of a,b,c
388 | {
389 | a = p2.y - p1.y;
390 | b = p1.x - p2.x;
391 | c = p2.x * p1.y - p1.x * p2.y;
392 | }
393 |
394 | void asIndex() {
395 | p1.anEdge = this;
396 | }
397 |
398 | Edge mostLeft() {
399 | Edge ee, e = this;
400 | while ( (ee = e.nextE.nextE.invE) != null && ee != this)
401 | e = ee;
402 | return e.nextE.nextE;
403 | }
404 |
405 | Edge mostRight() {
406 | Edge ee, e = this;
407 | while (e.invE != null && (ee = e.invE.nextE) != this)
408 | e = ee;
409 | return e;
410 | }
411 | }
412 |
413 | class Triangle {
414 |
415 | Edge anEdge; // edge of this triangle
416 | float c_cx, c_cy, c_r;
417 |
418 | public Triangle(Edge e1, Edge e2, Edge e3) {
419 | updateTriangle(e1, e2, e3);
420 | }
421 |
422 | public Triangle(ArrayList edges, Edge e1, Edge e2, Edge e3) {
423 | updateTriangle(e1, e2, e3);
424 | edges.add(e1);
425 | edges.add(e2);
426 | edges.add(e3);
427 | }
428 |
429 | public void updateTriangle(Edge e1, Edge e2, Edge e3) {
430 | anEdge = e1;
431 | e1.setNextE(e2);
432 | e2.setNextE(e3);
433 | e3.setNextE(e1);
434 | e1.setTri(this);
435 | e2.setTri(this);
436 | e3.setTri(this);
437 | findCircle();
438 | }
439 |
440 | boolean inCircle(Node nd) {
441 | return nd.distance(c_cx, c_cy) < c_r;
442 | }
443 |
444 | void removeEdges(ArrayList edges) {
445 | edges.remove(anEdge);
446 | edges.remove(anEdge.nextE);
447 | edges.remove(anEdge.nextE.nextE);
448 | }
449 |
450 | void findCircle() {
451 | float x1 = anEdge.p1.x, y1 = anEdge.p1.y, x2 = anEdge.p2.x, y2 = anEdge.p2.y;
452 | float x3 = anEdge.nextE.p2.x, y3 = anEdge.nextE.p2.y;
453 | float a = (y2 - y3) * (x2 - x1) - (y2 - y1) * (x2 - x3);
454 | float a1 = (x1 + x2) * (x2 - x1) + (y2 - y1) * (y1 + y2);
455 | float a2 = (x2 + x3) * (x2 - x3) + (y2 - y3) * (y2 + y3);
456 | c_cx = (a1 * (y2 - y3) - a2 * (y2 - y1)) / a / 2;
457 | c_cy = (a2 * (x2 - x1) - a1 * (x2 - x3)) / a / 2;
458 | c_r = anEdge.p1.distance(c_cx, c_cy);
459 | }
460 | }
461 |
462 |
--------------------------------------------------------------------------------
/daniel_howe/VoronoiRecode/VoronoiRecode.pde:
--------------------------------------------------------------------------------
1 | /**
2 | * This sketch is part of the ReCode Project - http://recodeproject.com
3 | * Computer Graphics and Art – May, 1978 – Vol. 3, No. 2 – Pg 11
4 | *
5 | * "Equidistant Space"
6 | * by Peter Milojevic
7 | *
8 | * direct recode by Daniel C. Howe (Delaunay code from Marcus Appel)
9 | *
10 | * Copyright (c) 2012 Daniel C. Howe
11 | *
12 | * Permission is hereby granted, free of charge, to any person
13 | * obtaining a copy of this software and associated documentation
14 | * files (the "Software"), to deal in the Software without
15 | * restriction, including without limitation the rights to use,
16 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
17 | * copies of the Software, and to permit persons to whom the
18 | * Software is furnished to do so, subject to the following
19 | * conditions:
20 |
21 | * The above copyright notice and this permission notice shall be
22 | * included in all copies or substantial portions of the Software.
23 |
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
28 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 | * OTHER DEALINGS IN THE SOFTWARE.
32 | */
33 |
34 | ArrayList nodes, edges, tris;
35 | Edge actE, hullStart, index[];
36 | Delaunay dt;
37 |
38 | void setup() {
39 |
40 | frameRate(10);
41 | size(580, 580);
42 | dt = new Delaunay(45);
43 | }
44 |
45 | void draw() {
46 |
47 | if (keyPressed && key==' ') return;
48 |
49 | update();
50 |
51 | background(255);
52 | strokeWeight(2);
53 | rect(0,0,width-1,height-1);
54 |
55 | float tcx, tcy;
56 | for (int i = 0; i < edges.size(); i++) {
57 |
58 | Edge e = (Edge) edges.get(i), ee = e.invE;
59 | if (ee == null || ee.inT == null) {
60 |
61 | tcx = e.inT.c_cx - e.p2.y + e.p1.y;
62 | tcy = e.inT.c_cy - e.p1.x + e.p2.x;
63 | }
64 | else {
65 | tcx = ee.inT.c_cx;
66 | tcy = ee.inT.c_cy;
67 | }
68 | line(e.inT.c_cx, e.inT.c_cy, tcx, tcy);
69 | }
70 |
71 | for (int i = 0; i < nodes.size(); i++)
72 | ellipse((nodeAt(i)).x - 1, (nodeAt(i)).y - 1,2,2);
73 | }
74 |
75 | void update() {
76 |
77 | background(255);
78 |
79 | // insert points at center
80 | int px = width/2;
81 | int py = height/2;
82 | dt.insert(px, py);
83 | dt.insert(px + 1, py);
84 | dt.insert(px + 1, py + 1);
85 | dt.insert(px, py + 1);
86 |
87 | // neighbors repulse each other
88 | int D = (int) Math.sqrt(nodes.size());
89 | for (int i = 0; i < edges.size(); i++) {
90 | Edge edge = (Edge) edges.get(i);
91 | clip2(edge.p1);
92 | clip2(edge.p2);
93 | int x = edge.p2.x - edge.p1.x;
94 | int y = edge.p2.y - edge.p1.y;
95 | int rr = x * x + y * y;
96 | if (rr < width * height / D / D)
97 | rr /= 2;
98 | if (rr > 0) {
99 | rr *= D;
100 | x = width * x / rr;
101 | y = height * y / rr;
102 | edge.p1.x -= x;
103 | edge.p1.y -= y;
104 | edge.p2.x += x;
105 | edge.p2.y += y;
106 | }
107 | }
108 |
109 | // move/scale the graph to fit
110 | ArrayList tmpNodes = new ArrayList();
111 | int xlo = width, ylo = height, xhi = 0, yhi = 0;
112 | for (int i = 0; i < nodes.size(); i++) {
113 | Node node = nodeAt(i);
114 | xlo = Math.min(xlo, node.x);
115 | ylo = Math.min(ylo, node.y);
116 | xhi = Math.max(xhi, node.x);
117 | yhi = Math.max(yhi, node.y);
118 | tmpNodes.add(node);
119 | }
120 |
121 | for (int i = 0; i < 4; i++)
122 | tmpNodes.remove((int) random(tmpNodes.size()));
123 |
124 | dt.clear();
125 | for (int i = 0; i < tmpNodes.size(); i++) {
126 | Node node = (Node) tmpNodes.get(i);
127 | int nx = (node.x - xlo) * width / (xhi - xlo);
128 | int ny = (node.y - ylo) * height / (yhi - ylo);
129 | dt.insert(nx,ny);
130 | }
131 | }
132 |
133 | void clip(Node p) {
134 | float d = dist(p.x,p.y,width/2,height/2);
135 | if (d > width/2) {
136 | p.x += (p.x < width/2) ? 1 : -1;
137 | p.y += (p.y < height/2) ? 1 : -1;
138 | }
139 | }
140 |
141 | Node nodeAt(int i) {
142 | return (Node) nodes.get(i);
143 | }
144 |
145 |
--------------------------------------------------------------------------------
/genevieve_hoffman/Aaron_Marcus_Untitled_1/Aaron_Marcus_Untitled_1.pde:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/genevieve_hoffman/Aaron_Marcus_Untitled_2/Aaron_Marcus_Untitled_2.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 16
3 | // by Aaron Marcus
4 | // "Untitled photoprint", 15" x 19"
5 | // Other works in the Hieroglyphs series are "Noise Barrier", and various "Untitled" works.
6 | //
7 | // Genevieve Hoffman
8 | // 2012
9 | // Creative Commons license CC BY-SA 3.0
10 |
11 | void setup() {
12 | size(800,800);
13 | background(0);
14 |
15 | int gridSize = width/10;
16 |
17 | for (int x = gridSize; x <= width; x += gridSize) {
18 | for (int y = gridSize; y <= height; y += gridSize) {
19 |
20 | //make grid
21 | stroke(255);
22 | smooth();
23 | line(x, 0, x, height);
24 | line(x-gridSize, y, width, y);
25 |
26 | //generate random seed values for location and size
27 | float randLoc = random(-gridSize/2,gridSize/2);
28 | float randLoc2 = random(-gridSize/2,gridSize/2);
29 | float randLoc3 = random(-gridSize/2,gridSize/2);
30 | float randLoc4 = random(-gridSize/2,gridSize/2);
31 | float randLoc5 = random(-gridSize/2,gridSize/2);
32 | float randLoc6 = random(-gridSize/2,gridSize/2);
33 | float randLoc7 = random(-gridSize/2,gridSize/2);
34 | float randLoc8 = random(-gridSize/2,gridSize/2);
35 | float circSize = random(0, gridSize-10);
36 | float sqSize = random(0, (gridSize-10)/2);
37 |
38 | //draw circles
39 | noFill();
40 | ellipse(x+randLoc, y+ randLoc2, circSize, circSize);
41 |
42 | //draw squares
43 | pushMatrix();
44 | translate(x+randLoc3, y+randLoc4);
45 | rotate(random(TWO_PI));
46 | rect(0, 0, sqSize, sqSize);
47 | popMatrix();
48 |
49 | //draw lines
50 | pushMatrix();
51 | translate(x+randLoc5, y+randLoc6);
52 | rotate(random(TWO_PI));
53 | line(0,0,randLoc7, randLoc8);
54 | popMatrix();
55 | }
56 | }
57 | }
58 |
59 | void draw() {
60 |
61 | }
62 |
63 | void keyPressed() {
64 | //saveFrame("Aaron_Marcus_Untitled2_###.jpg");
65 | }
66 |
--------------------------------------------------------------------------------
/genevieve_hoffman/Reiner_Schneeberger_Untitled2_Various/Reiner_Schneeberger_Untitled2_Various.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol1 no4 pg 29
3 | // by Reiner Schneeberger and students
4 | // Computer graphics made at the University of Munich (West Germany)
5 | //
6 | // Genevieve Hoffman
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | //1. Size of the sheet of paper.
11 | //2. A scale distortion of 1:2 in one direction.
12 | //3. The routine SNEKAD with eight parameters.
13 | //The routine SNEKAO proves here two elements:
14 | //1. 2. .
15 | //These squares occur in a random order.
16 | //The scale distortion of 1:2 stretches the elements in one direction to produce graying effects.
17 |
18 | int cols = 10;
19 | int rows = 80;
20 | int counter = 0;
21 |
22 | void setup() {
23 | size(540, 800);
24 | background(255);
25 | stroke(0);
26 |
27 | float horiz = width/cols;
28 | float vert = horiz/2;
29 |
30 | for (int i = 0; i < rows; i++) {
31 | for (int j = 0; j < cols; j++) {
32 | float rand = random(0, 2);
33 | if (rand > 1) {
34 | //draw vertical lines
35 | for (float k = 0; k < horiz; k+=horiz/8) {
36 | line(j*horiz+k, i*vert, j*horiz+k, i*vert+vert);
37 | }
38 | }
39 | else {
40 | //draw horizontal lines
41 | for(float k = 0; k < vert; k+=vert/8) {
42 | line(j*horiz, i*vert+k, j*horiz+horiz, i*vert + k);
43 | }
44 | }
45 | }
46 | }
47 | }
48 |
49 | void draw() {
50 | }
51 |
52 | void keyPressed() {
53 | //saveFrame("Reiner_Schneeberger_Untitled2_####.jpg");
54 | }
55 |
--------------------------------------------------------------------------------
/gerald_kogler/VariationOn9Squares/Square.pde:
--------------------------------------------------------------------------------
1 | class Square {
2 | int x,y; //position in grid
3 | boolean hor; //orientation of squares
4 |
5 | Square(int x, int y, boolean hor){
6 | this.x = x;
7 | this.y = y;
8 | this.hor = hor;
9 | }
10 |
11 | void draw() {
12 | float step = 0;
13 | for (float angle=0; angle<=HALF_PI; angle+=step) {
14 | if (mode == 'e') step = (HALF_PI+0.1-angle)*ease;
15 | else step = HALF_PI/(ease*10);
16 |
17 | float cx = margin + x*(2*r-overlap);
18 | float cy = margin + y*(2*r-overlap);
19 | float sx,sy;
20 | if (hor) {
21 | sx = r +r * cos(angle);
22 | sy = r+ r * sin(angle);
23 | }
24 | else {
25 | sx = r + r * sin(angle);
26 | sy = r + r * cos(angle);
27 | }
28 | float sw = (r - sx) * 2;
29 | float sh = (r - sy) * 2;
30 | rect(cx+sx, cy+sy, sw, sh);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/gerald_kogler/VariationOn9Squares/VariationOn9Squares.pde:
--------------------------------------------------------------------------------
1 | /*
2 | * This sketch is part of the ReCode Project - http://recodeproject.com
3 | * from Computer Graphics and Art Magazine, Vol. 1, No. 2, May 1976, page 17
4 | * "Variation on 9 Squares"
5 | * by Roger Vilder
6 | * from the SDL Collection
7 | *
8 | * Gerald Kogler
9 | * Nov. 14 2012
10 | * Creative Commons license CC BY-SA 3.0
11 | */
12 |
13 | int s = 480; //size of sketch
14 | int num = 3; //num of lines and columns in grid
15 | float margin = 30; //margin around rectangles areas
16 | float overlap = 40; //overlap of reactangle areas
17 | float ease = 0.3; //easing/division factor for non/linear distribution
18 | char mode = 'e'; //mode 'l'==linear, 'e'==exponential distribution
19 | color bg = 0;
20 | float r;
21 | Square[] squares = new Square[num*num];
22 |
23 | void setup() {
24 | size(480,480);
25 | noFill();
26 | stroke(255);
27 | r = ((width-2*margin)/num)/2+overlap/num;
28 |
29 | //make instances of squares
30 | for (int y=0; y 0.15) ease-=0.1;
64 | }
65 | else if (key == '-') {
66 | if (ease < 1.0) ease+=0.1;
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/greg_borenstein/StructuredSquareSeriesInwards/StructuredSquareSeriesInwards.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol1 no3 pg 25
3 | // by Roger Coqart
4 | // "Structured Square Series -- Inwards", drawing 28 x 28 cm.
5 | // Other works in the series are "Horizontal Rows", "Outwards", as
6 | // well as the "Permutation" works.
7 | //
8 | // Greg Borenstein
9 | // 2012
10 | // Creative Commons license CC BY-SA 3.0
11 |
12 | int rowSize = 15;
13 | int marginSize = 6;
14 | int boxSize = 14;
15 |
16 | ArrayList strokes;
17 |
18 | void setup() {
19 | size(350, 350);
20 | noFill();
21 | stroke(0);
22 | noLoop();
23 |
24 | strokes = new ArrayList();
25 | for (int i =0; i < 8; i++) {
26 | strokes.add(i);
27 | }
28 | }
29 |
30 | void draw() {
31 | background(255);
32 |
33 | translate(boxSize*2, boxSize*2);
34 |
35 | for (int row =0; row < rowSize; row++) {
36 | for (int col =0; col < rowSize; col++) {
37 | int x = boxSize*col + marginSize*col;
38 | int y = boxSize*row + marginSize*row;
39 |
40 | pushMatrix();
41 | translate(x, y);
42 | rect(0, 0, boxSize, boxSize);
43 |
44 | // this is the one clever bit:
45 | // measure the distance of the square from the
46 | // center in concentric rings to find out how many segments to draw
47 | int middle = 7;
48 | int distFromMiddle = max(abs(row - middle), abs(col-middle));
49 |
50 | // do the strokes in a random different order each time
51 | Collections.shuffle(strokes);
52 | for (int i = 0; i < distFromMiddle; i++) {
53 | drawSegment( strokes.get(i), boxSize, boxSize);
54 | }
55 |
56 | popMatrix();
57 | }
58 | }
59 | }
60 |
61 | void drawSegment(int i, int w, int h) {
62 | switch(i) {
63 | case 0:
64 | line(0, 0, w, h);
65 | break;
66 |
67 | case 1:
68 | line(w, 0, 0, h);
69 | break;
70 |
71 | case 2:
72 | line(0, h/2, w, h/2);
73 | break;
74 |
75 | case 3:
76 | line(0, h/2, w/2, 0);
77 | break;
78 |
79 | case 4:
80 | line(w/2, 0, w, h/2);
81 | break;
82 |
83 | case 5:
84 | line(w, h/2, w/2, h);
85 | break;
86 |
87 | case 6:
88 | line(w/2, 0, w/2, h);
89 | break;
90 |
91 | case 7:
92 | line(w/2, h, 0, h/2);
93 | break;
94 | }
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/hugh_kennedy/untitled2/untitled2.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol2 no3 pg 5
3 | // by Vladimir Bonačic
4 | // "Untitled 2" (Examples of four consecutive patters generated by the 'Dynamic Object'...)
5 | //
6 | // Hugh Kennedy
7 | // 2012
8 | // Creative Commons License CC BY-SA 3.0
9 |
10 | // Uses the "Munching Square" hack:
11 | // http://en.wikipedia.org/wiki/Munching_square
12 | // i.e. a plot of y = x XOR t, for multiple values of t.
13 |
14 | int columns = 32;
15 | int rows = 32;
16 | int margin = 32;
17 | int padding = 8;
18 | int squareWidth = 8;
19 | int squareHeight = 8;
20 |
21 | int[][] tValues = {
22 | { 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 26, 9000 },
23 | { 0, 31, 94, 93, 91, 90, 89, 9000, 8, 9, 10, 11, 28, 33, 34, 35, 36, 37, 38, 39 },
24 | { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 900, 12010, 12011 },
25 | { 5, 6, 19, 18 }
26 | };
27 |
28 | void drawGrid(int gridX, int gridY, int[] squares) {
29 | stroke(0);
30 | fill(0);
31 |
32 | rect(
33 | gridX - padding,
34 | gridY - padding,
35 | squareWidth * columns + padding * 2,
36 | squareHeight * rows + padding * 2
37 | );
38 |
39 | fill(255);
40 |
41 | int t, y;
42 |
43 | for (int i = 0, l = squares.length; i < l; i += 1) {
44 | t = squares[i];
45 |
46 | for (int x = 0; x < columns; x += 1) {
47 | y = (x ^ t) % rows;
48 |
49 | rect(
50 | gridX + x * squareWidth,
51 | gridY + y * squareHeight,
52 | squareWidth,
53 | squareHeight
54 | );
55 | }
56 | }
57 | }
58 |
59 | void setup() {
60 | size(
61 | 2 * columns * squareWidth + 3 * margin,
62 | 2 * rows * squareHeight + 3 * margin
63 | );
64 | noLoop();
65 | }
66 |
67 | void draw() {
68 | background(255);
69 | for (int i = 0; i < tValues.length; i += 1) {
70 | drawGrid(
71 | (i % 2) * (columns * squareWidth + margin) + margin,
72 | floor(i / 2) * (rows * squareHeight + margin) + margin,
73 | tValues[i]
74 | );
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/isaac_gierard/StevenHCullinane_DiamondTheory/StevenHCullinane_DiamondTheory.pde:
--------------------------------------------------------------------------------
1 | color c1 = color(255);
2 | color c2 = color(0);
3 | class Diamond {
4 |
5 | int qSide = 4;
6 | public float drawScale = 10;
7 | ArrayList items = new ArrayList();
8 |
9 | Diamond(int qSide){
10 | this.qSide = qSide;
11 | this.generate();
12 | }
13 | public void generate(){
14 | // for(int i = 0; i < qSide*qSide; i++){
15 | // items.add(Integer.valueOf(int(random(0,4))));
16 | // }
17 | // "Latin" generation
18 | items.clear();
19 | HashSet testSet = new HashSet();
20 | for(int i = 0; i < qSide*qSide; i++){
21 | testSet.clear();
22 | Integer v = Integer.valueOf(int(random(0,qSide)));
23 | boolean again = false;
24 | int x = i%qSide;
25 | int y = i/qSide;
26 | // println(x+","+y+" -");
27 |
28 | do{
29 | again = false;
30 | for(int j = 0; j < x; j++){
31 | Integer tv = items.get(y*qSide+j);
32 | // println("test "+tv+","+v);
33 | testSet.add(tv);
34 | }
35 | for(int j = 0; j < y; j++){
36 | Integer tv = items.get(j*qSide+x);
37 | // println("check index "+(j*qSide+x));
38 | testSet.add(tv);
39 | }
40 | do{
41 | v = Integer.valueOf(int(random(0,qSide)));
42 | // println("size "+testSet.size());
43 | // println(testSet.contains(v));
44 | }while(testSet.contains(v) && testSet.size() < qSide);
45 | }while(again);
46 | items.add(v);
47 |
48 | }
49 | this.prt();
50 | int r = int(random(0,3));
51 | if(r == 0){
52 | this.mirror(int(random(0,2)));
53 | }else if(r == 1){
54 | this.invert(int(random(0,2)));
55 | }else{
56 | this.loop();
57 | }
58 | this.prt();
59 | }
60 |
61 | public void loop(){
62 | this.mirror(0);
63 | this.mirror(1);
64 | }
65 |
66 | public void mirror(int axis){
67 | if(axis == 0){
68 | for(int x = 0; x < qSide/2; x++){
69 | for(int y = 0; y < qSide; y++){
70 | int tx = qSide-1-x;
71 | items.set(y*qSide+tx, Integer.valueOf(this.mirrorElementX(items.get(y*qSide+x).intValue())) );
72 | }
73 | }
74 | }else{
75 | for(int y = 0; y < qSide/2; y++){
76 | for(int x = 0; x < qSide; x++){
77 | int ty = qSide-1-y;
78 | println(y+" : "+ty);
79 | items.set(ty*qSide+x, Integer.valueOf(this.mirrorElementY(items.get(y*qSide+x).intValue())) );
80 | }
81 | }
82 | }
83 | }
84 |
85 | public void invert(int axis){
86 | if(axis == 0){
87 | for(int x = 0; x < qSide/2; x++){
88 | for(int y = 0; y < qSide; y++){
89 | int tx = qSide-1-x;
90 | items.set(y*qSide+tx, Integer.valueOf(this.invertElement(items.get(y*qSide+x).intValue())) );
91 | }
92 | }
93 | }else{
94 | for(int y = 0; y < qSide/2; y++){
95 | for(int x = 0; x < qSide; x++){
96 | int ty = qSide-1-y;
97 | items.set(ty*qSide+x, Integer.valueOf(this.invertElement(items.get(y*qSide+x).intValue())) );
98 | }
99 | }
100 | }
101 | }
102 |
103 | int mirrorElementX(int e){
104 | if(e == 1) return 2;
105 | if(e == 2) return 1;
106 | if(e == 0) return 3;
107 | if(e == 3) return 0;
108 | return 0;
109 | }
110 | int mirrorElementY(int e){
111 | if(e == 1) return 0;
112 | if(e == 0) return 1;
113 | if(e == 3) return 2;
114 | if(e == 2) return 3;
115 | return 0;
116 | }
117 | int invertElement(int e){
118 | if(e == 1) return 3;
119 | if(e == 3) return 1;
120 | if(e == 2) return 0;
121 | if(e == 0) return 2;
122 | return 0;
123 | }
124 | // int invertElement(int e){
125 | // if(e == 1) return 3;
126 | // if(e == 3) return 1;
127 | // if(e == 2) return 0;
128 | // if(e == 0) return 2;
129 | // return 0;
130 | // }
131 |
132 | public void draw(){
133 | pushMatrix();
134 | for(int y = 0; y < qSide; y++){
135 | pushMatrix();
136 | for(int x = 0; x < qSide; x++){
137 | drawTri(items.get(qSide*y+x).intValue(),drawScale);
138 | translate(drawScale,0);
139 | }
140 | popMatrix();
141 | translate(0,drawScale);
142 | }
143 | popMatrix();
144 | }
145 | public void prt(){
146 | for(int y = 0; y < qSide; y++){
147 | for(int x = 0; x < qSide; x++){
148 | if(items.size() > y*qSide+x){
149 | print(items.get(y*qSide+x).intValue()+",");
150 | }
151 | }
152 | print("\n");
153 | }
154 | }
155 | public void drawTri(int orientation,float s){
156 | noStroke();
157 | fill(c1);
158 | rect(0,0,s,s);
159 | fill(c2);
160 | switch(orientation){
161 | case 0:
162 | /*
163 | *
164 | **
165 | */
166 | beginShape();
167 | vertex(s,0);
168 | vertex(s,s);
169 | vertex(0,s);
170 | endShape(CLOSE);
171 | break;
172 | case 1:
173 | /*
174 | **
175 | *
176 | */
177 | beginShape();
178 | vertex(0,0);
179 | vertex(s,0);
180 | vertex(s,s);
181 | endShape(CLOSE);
182 | break;
183 | case 2:
184 | /*
185 | **
186 | *
187 | */
188 | beginShape();
189 | vertex(s,0);
190 | vertex(0,0);
191 | vertex(0,s);
192 | endShape(CLOSE);
193 | break;
194 | case 3:
195 | /*
196 | *
197 | **
198 | */
199 | beginShape();
200 | vertex(0,0);
201 | vertex(0,s);
202 | vertex(s,s);
203 | endShape(CLOSE);
204 | break;
205 | }
206 | }
207 | }
208 | Diamond d = new Diamond(4);
209 |
210 | void setup(){
211 | background(255);
212 | int spacing = 16;
213 | int rows = 10;
214 | int cols = 10;
215 | size(
216 | int((d.drawScale*d.qSide+spacing)*cols)+spacing,
217 | int((d.drawScale*d.qSide+spacing)*rows)+spacing
218 | );
219 | translate(spacing,spacing);
220 | for(int y = 0; y < rows; y++){
221 | pushMatrix();
222 | for(int x = 0; x < cols; x++){
223 | d.generate();
224 | d.draw();
225 | translate(d.drawScale*d.qSide+spacing,0);
226 | }
227 | popMatrix();
228 | translate(0,d.drawScale*d.qSide+spacing);
229 | }
230 | }
231 |
--------------------------------------------------------------------------------
/jon_bobrow/ExperimentalEsthetics_04/ExperimentalEsthetics_04.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 22
3 | // by Reiner Schneeberger
4 | //
5 | // Untitled #5 is part of a 10 piece series, intended to test viewers
6 | // perception of art and composition. The section is titled "Experimental
7 | // Esthetics with Computer Graphics -- Analyses of Viewers Impressions
8 | // of Computer Graphics."
9 | //
10 | // Jonathan Bobrow
11 | // 2012
12 | // Creative Commons license CC BY-SA 3.0
13 | //
14 | // note: .f enforces float division, dividing by an int would automatically round down
15 | // i.e. 1/2 = 0 , 1/2.f = .5
16 |
17 | int gridSize = 30;
18 | int density = 7;
19 |
20 | void setup(){
21 | size(480, 720);
22 | background(255);
23 |
24 | stroke(0);
25 | strokeWeight(1);
26 | float padding = gridSize/(float)density; // even spacing for lines
27 |
28 | int rows = height/gridSize;
29 | int cols = width/gridSize;
30 |
31 | for(int i = 0; i < rows; i++){ // iterate over the # of rows (top to bottom)
32 | for(int j = 0; j < cols; j++){ // iterate over the # of columns (left to right)
33 |
34 | pushMatrix();
35 | translate(j*gridSize, i*gridSize); // move to grid location
36 | translate(gridSize/2.f, gridSize/2.f); // move to rotate around center
37 | if(random(1) < .5)
38 | rotate(PI/2); // rotate vertical or horizontal
39 | else
40 | rotate(PI);
41 |
42 | for(int k = 0; k < density; k++){ // draw # of lines based on density with even spacing
43 | float _x = (k - density/2.f) * padding;
44 | line(_x, -gridSize/2.f, _x, gridSize/2.f);
45 | }
46 | popMatrix();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/jon_bobrow/ExperimentalEsthetics_05/ExperimentalEsthetics_05.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 22
3 | // by Reiner Schneeberger
4 | //
5 | // Untitled #5 is part of a 10 piece series, intended to test viewers
6 | // perception of art and composition. The section is titled "Experimental
7 | // Esthetics with Computer Graphics -- Analyses of Viewers Impressions
8 | // of Computer Graphics."
9 | //
10 | // Jonathan Bobrow
11 | // 2012
12 | // Creative Commons license CC BY-SA 3.0
13 | //
14 | // note: .f enforces float division, dividing by an int would automatically round down
15 | // i.e. 1/2 = 0 , 1/2.f = .5
16 |
17 | int gridSize = 40;
18 | int density = 3;
19 |
20 | void setup(){
21 | size(480, 720);
22 | background(255);
23 |
24 | stroke(0);
25 | strokeWeight(1);
26 | float padding = gridSize/(float)density; // even spacing for lines
27 |
28 | int rows = height/gridSize;
29 | int cols = width/gridSize;
30 |
31 | for(int i = 0; i < rows; i++){ // iterate over the # of rows (top to bottom)
32 | for(int j = 0; j < cols; j++){ // iterate over the # of columns (left to right)
33 |
34 | pushMatrix();
35 | translate(j*gridSize, i*gridSize); // move to grid location
36 | translate(gridSize/2.f, gridSize/2.f); // move to rotate around center
37 | if(random(1) < .5) rotate(PI/2); // rotate vertical or horizontal
38 |
39 | for(int k = 0; k < density; k++){ // draw # of lines based on density with even spacing
40 | float _x = (k - density/2.f) * padding;
41 | line(_x, -gridSize/2.f, _x, gridSize/2.f);
42 | }
43 | popMatrix();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/jon_bobrow/ExperimentalEsthetics_06/ExperimentalEsthetics_06.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 22
3 | // by Reiner Schneeberger
4 | //
5 | // Untitled #5 is part of a 10 piece series, intended to test viewers
6 | // perception of art and composition. The section is titled "Experimental
7 | // Esthetics with Computer Graphics -- Analyses of Viewers Impressions
8 | // of Computer Graphics."
9 | //
10 | // Jonathan Bobrow
11 | // 2012
12 | // Creative Commons license CC BY-SA 3.0
13 | //
14 | // note: .f enforces float division, dividing by an int would automatically round down
15 | // i.e. 1/2 = 0 , 1/2.f = .5
16 |
17 | int gridSize = 30;
18 | int density = 7;
19 |
20 | void setup(){
21 | size(480, 720);
22 | background(255);
23 |
24 | stroke(0);
25 | strokeWeight(1);
26 | float padding = gridSize/(float)density; // even spacing for lines
27 |
28 | int rows = height/gridSize;
29 | int cols = width/gridSize;
30 |
31 | for(int i = 0; i < rows; i++){ // iterate over the # of rows (top to bottom)
32 | for(int j = 0; j < cols; j++){ // iterate over the # of columns (left to right)
33 |
34 | pushMatrix();
35 | translate(j*gridSize, i*gridSize); // move to grid location
36 | translate(gridSize/2.f, gridSize/2.f); // move to rotate around center
37 |
38 | float prob = map(j/(float)cols, 0, 1, .2, .8); // probability between .2 and .8
39 | if(random(1) < prob) // higher probability vertical on the left side
40 | rotate(3*PI/2); // rotate horizontal
41 | else
42 | rotate(PI);
43 |
44 | for(int k = 0; k < density; k++){ // draw # of lines based on density with even spacing
45 | float _x = (k - density/2.f) * padding;
46 | line(_x, -gridSize/2.f, _x, gridSize/2.f);
47 | }
48 | popMatrix();
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/krystof_pesek/Structure/Structure.pde:
--------------------------------------------------------------------------------
1 | /**
2 | * This sketch is part of the ReCode Project - http://recodeproject.com
3 | * From Computer Graphics and Art vol1 no2
4 | *
5 | * "Structure"
6 | * by Zdenek Sykora 1976
7 | *
8 | * experimental recode by Krystof Pesek 2012
9 | * released under Creative Commons Attribution-ShareAlike 3.0 license
10 | *
11 | */
12 |
13 | /////////////////////////////////
14 |
15 | float theta[];
16 | PGraphics plny;
17 | int [] moznosti = {0,90,180,270};
18 | float [] rot = {1,2,4};
19 | float r;
20 |
21 | /////////////////////////////////
22 |
23 | void setup(){
24 | size(576,704,P2D);
25 | imageMode(CENTER);
26 |
27 | plny = createGraphics(32,32,JAVA2D);
28 | createShaped();
29 |
30 | theta = new float[3000];
31 | for (int i = 0 ; i < theta.length ; i ++){
32 | theta[i] = moznosti[(int)random(4)];
33 | }
34 | }
35 |
36 | /////////////////////////////////
37 |
38 | void draw(){
39 | background(0);
40 |
41 | r = plny.width;
42 |
43 | int idx = 0;
44 | for(int y = 0;y <= height/plny.height;y++){
45 | for(int x = 0;x <= width/plny.width;x++){
46 | pushMatrix();
47 | translate(x*r+plny.width/2,y*r+plny.height/2);
48 | rotate(radians(theta[idx]));
49 | theta[idx] += 0.004*degrees(frameCount/200.0*atan2(mouseY-y*r,mouseX-x*r));
50 | image (plny,0,0);
51 | popMatrix();
52 |
53 | idx += 1;
54 | }
55 | }
56 | }
57 |
58 | /////////////////////////////////
59 |
60 | void createShaped(){
61 | int W = plny.width;
62 | int H = plny.height;
63 |
64 | plny.beginDraw();
65 | plny.smooth();
66 | plny.fill(255);
67 | plny.noStroke();
68 | plny.arc(W/2,H/2,W-2,H-2,0,PI);
69 | plny.endDraw();
70 | }
71 |
72 | /////////////////////////////////
73 |
--------------------------------------------------------------------------------
/kyle_mcdonald/RandomSquares/RandomSquares.pde:
--------------------------------------------------------------------------------
1 | /*
2 | methods:
3 | 1. vernacular
4 | preserve the spirit of the image
5 | least work
6 | but the influence of the original tool is lost
7 | 2. rosetta
8 | preserve the spirit of the code itself
9 | connects old languages to new languages
10 | 3. revival
11 | write a parser to run the original code
12 | most work
13 | preserves everything but the output medium (plotter)
14 | */
15 |
16 | /*
17 | // JOB
18 | // FOR RDMSQ
19 | *NONPROCESS PROGRAM
20 | *ONE WORD INTEGERS
21 | *LIST SOURCE PROGRAM
22 | *INCS(CARD,1443 PRINTER)
23 | C******************PROGRAMMED FOR COMPUTER GRAPHICS AND ART BY BILL KULOMYJEC
24 | DIMENSION A(4,2),B(4,2),AA(4,2),BB(4,2)
25 | C PROVIDE MEMORY FOR 2 SETS OF SQUARES, RANDOMIZE
26 | CALL RANST
27 | C DEFINE VARIABLES
28 | NUMX=5
29 | NUMY=7
30 | C BSS=THE SIZE OF THE SIDE OF THE SQUARE, SSPCT=THE PERCENT
31 | C OF THE SIZE OF THE INSIDE SQUARE
32 | BSS=1.25
33 | SSPCT=0.20
34 | HFBSS=BSS/2.0
35 | C VLIMIT IS THE MAXIMUM AMOUNT THE INNER SQUARE MAY VARY
36 | VLIMT=HFBSS-(BSS*SSPCT/2.0)
37 | C SET UP CORNERS OF BIG SQUARE
38 | A(1,1)= HFBSS
39 | A(1,2)= HFBSS
40 | A(2,1)=-HFBSS
41 | A(2,2)= HFBSS
42 | A(3,1)=-HFBSS
43 | A(3,2)=-HFBSS
44 | A(4,1)= HFBSS
45 | A(4,2)=-HFBSS
46 | C SCALE DOWN SMALL SQUARE BY SSPCT
47 | DO 100 J=1,4
48 | DO 100 K=1,2
49 | 100 B(J,K)=A(J,K)*SSPCT
50 | C INITIALIZE PLOTTER
51 | CALL HYPLT (0.,0.,0)
52 | C BEGIN DRAWING RANDOM SQUARE MODULES
53 | DO 200 J=1,NUMY
54 | YC=FLOAT(J-1)*BSS
55 | DO 200 K=1,NUMX
56 | XC=FLOAT(K-1)*BSS
57 | C ADJUST OUTER SQUARE TO RELATIVE LOCATION
58 | DO 201 L=1,4
59 | AA(L,1)=A(L,1)+XC
60 | AA(L,2)=A(L,2)+YC
61 | 201 CONTINUE
62 | C DETERMINE X AND Y VARIANCE BASED ON VLIMT
63 | XVAR=RANF(0)*VLIMT-(VLIMT/2.0)
64 | YVAR=RANF(0)*VLIMT-(VLIMT/2.0)
65 | C ADJUST INNER SQUARE TO RELATIVE LOCATION, ADD VARIANCE
66 | DO 202 M=1,4
67 | BB(M,1)=B(M,1)+XVAR+XC
68 | BB(M,2)=B(M,2)+YVAR+YC
69 | 202 CONTINUE
70 | C DETERMINE RANDOM NUMBER OF INTERVALS (BETWEEN 2 AND 10)
71 | NSPCS=9*RANF(D)+2
72 | C PLOT EACH MODULE
73 | DO 203 N=1,NSPCS
74 | C P CALCULATES RELATIVE SPACING ON NSPCS
75 | P=FLOAT(N-1)/(NSPCS-1)
76 | X=AA(4,1)+P*(BB(4,1)-AA(4,1))
77 | Y=AA(4,2)+P*(BB(4,2)-AA(4,2))
78 | C MOVE THE PEN TO THE LAST CORNER OF THE SQUARE
79 | CALL HYPLT (X,Y,2)
80 | C PLOT INTERMEDIATE SQUARES
81 | DO 300 I=1,4
82 | X=AA(I,1)+P*(BB(I,1)-AA(I,1))
83 | Y=AA(I,2)+P*(BB(I,2)-AA(I,2))
84 | 300 CALL HYPLT (X,Y,1)
85 | 203 CONTINUE
86 | 200 CONTINUE
87 | C TERMINATE
88 | CALL HYPLT (0.,0.,-1)
89 | CALL EXIT
90 | END
91 |
92 | FEATURES SUPPORTED
93 | NONPROCESS
94 | ONE WORD INTEGERS
95 | INCS
96 |
97 | CORE REQUIREMENTS FOR RDMSQ
98 | COMMON O INSKEL COMMON 0 VARIABLES 110 PROGRAM 444
99 | */
100 |
101 | void setup() {
102 | size(500, 700);
103 | background(255);
104 | noLoop();
105 | }
106 |
107 | void draw() {
108 | //vernacular();
109 | rosetta();
110 | }
111 |
--------------------------------------------------------------------------------
/kyle_mcdonald/RandomSquares/Rosetta.pde:
--------------------------------------------------------------------------------
1 | /*
2 | translation notes:
3 | * BASIC uses 1-indexed arrays, Java uses 0-indexed arrays
4 | * lines with //? have no corollary in this environment
5 | * with a few exceptions, there is no decorative whitespace in the original code
6 | * RANF(0) corresponds to random(1)
7 | * the HYPLT plotter interface is replaced with beginShape/endShape helper functions
8 | */
9 |
10 | void rosetta() {
11 | // ******************PROGRAMMED FOR COMPUTER GRAPHICS AND ART BY BILL KULOMYJEC
12 | float[][]
13 | A = new float[4][2],
14 | B = new float[4][2],
15 | AA = new float[4][2],
16 | BB = new float[4][2];
17 | // PROVIDE MEMORY FOR 2 SETS OF SQUARES, RANDOMIZE
18 | randomSeed(0); //CALL RANST
19 | // DEFINE VARIABLES
20 | int NUMX=5;
21 | int NUMY=7;
22 | // BSS=THE SIZE OF THE SIDE OF THE SQUARE, SSPCT=THE PERCENT
23 | // OF THE SIZE OF THE INSIDE SQUARE
24 | float BSS=1.25;
25 | float SSPCT=0.20;
26 | float HFBSS=BSS/2.0;
27 | // VLIMIT IS THE MAXIMUM AMOUNT THE INNER SQUARE MAY VARY
28 | float VLIMT=HFBSS-(BSS*SSPCT/2.0);
29 | // SET UP CORNERS OF BIG SQUARE
30 | A[0][0]= HFBSS;
31 | A[0][1]= HFBSS;
32 | A[1][0]=-HFBSS;
33 | A[1][1]= HFBSS;
34 | A[2][0]=-HFBSS;
35 | A[2][1]=-HFBSS;
36 | A[3][0]= HFBSS;
37 | A[3][1]=-HFBSS;
38 | // SCALE DOWN SMALL SQUARE BY SSPCT
39 | for(int J=0;J<4;J++) {
40 | for(int K=0;K<2;K++) {
41 | B[J][K]=A[J][K]*SSPCT;
42 | }
43 | }
44 | // INITIALIZE PLOTTER
45 | HYPLT(0.,0.,0);
46 | // BEGIN DRAWING RANDOM SQUARE MODULES
47 | for(int J=0;J 0) {
82 | rect(led * x, led * y, led, led);
83 | }
84 |
85 | }
86 | }
87 |
88 | // jump to a different pattern
89 | if( animate && frameCount % frames == 0) {
90 | p *= 2;
91 | if(p >= 1l<= d*d ) i ^= p;
81 | }
82 |
83 | // draw display
84 | for (i = 0; i < d*d; i++) {
85 | if (field[i]) {
86 | ellipse(led * (i % d), led * floor(i / d), led, led);
87 | }
88 | }
89 | }
90 |
91 |
92 | void keyPressed() {
93 | switch(key) {
94 | // switch between presets
95 | case ' ': pick = (pick + 1) % preset.length; p = preset[pick]; break;
96 | // next pattern
97 | case '+': p = (p + 1) | d; break;
98 | // previous pattern
99 | case '-': p = (p - 1) | d; break;
100 | // toggle debugging
101 | case 'd': debug = !debug; break;
102 | // switch background color
103 | case 'b': bg = 255 - bg; break;
104 | default: return;
105 | }
106 | }
107 |
108 |
109 | void mouseClicked() {
110 | info();
111 | }
112 |
113 |
114 | // show generator polynomial + orbit entry point
115 | void info() {
116 | if (debug) println("p = [" + binary((int) + p, d)+ "] = " + p + "; i0 = " + i0);
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/martin_schneider/untitled_1/untitled_1.pde:
--------------------------------------------------------------------------------
1 |
2 | // This sketch is part of the ReCode Project - http://recodeproject.com
3 |
4 | ////////////////////////////////////////////////////////////////////////
5 | // //
6 | // "Orbits of Galois Fields" by Vladimir Bonačić //
7 | // //
8 | // ( untitled 1) //
9 | // //
10 | ////////////////////////////////////////////////////////////////////////
11 |
12 | // (c) Martin Schneider 2012
13 |
14 | // Creative Commons license CC BY-SA 3.0
15 |
16 | // These patterns are displayed using 32 x 32 dots.
17 | // They visualize objects from abstract algebra,
18 | // namely orbits of galois fields.
19 |
20 | // Source:
21 | // "Research and Teaching in Art and Science" by Vladimir Bonačić
22 | // Computer Graphics and Art Vol. 2, No. 3 pp. 4-8
23 |
24 | // See also:
25 | // "Kinetic Art: Application of Abstract Algebra to Objects with Computer-
26 | // Controlled Flashing Lights and Sound Combinations" by Vladimir Bonačić
27 | // Leonardo, Vol. 7, No. 3
28 | // Note: This paper is quite mathematical at times.
29 | // The implementation however is actually really simple.
30 |
31 |
32 | /////////////////////////////// UNTITLED 1 ////////////////////////////
33 |
34 | // This is a recreation of the four orbits shown in the right column
35 |
36 | // Fig e) and f) generator polynomial: x^10 + x^7 + x^2 + 1
37 | // Fig g) and h) generator polynomial: x^10 + x^5 +x^4 +x^3 + x^2 + x^1 + 1
38 |
39 | // NOTE:
40 | // The images in the original publication are flipped in various ways.
41 | // This may be due to different axis directions, indexing order,
42 | // an error in reproduction, or a combination of all of the above.
43 |
44 |
45 | ////////////////////////////////////////////////////////////////////////
46 |
47 | int n = 5; // bits per dimension
48 | int d = 1<= d*d ) i ^= p;
79 | }
80 |
81 | // draw display
82 | background(255);
83 | for(i = 0; i < d*d; i++) {
84 | if(field[i]) {
85 | ellipse( led * (i % d), led * (i / d), led, led);
86 | }
87 | }
88 |
89 | }
90 |
91 |
92 | void keyPressed() {
93 | pick = (pick + 1) % preset.length;
94 | }
95 |
--------------------------------------------------------------------------------
/martin_schneider/untitled_2/untitled_2.pde:
--------------------------------------------------------------------------------
1 |
2 | ////////////////////////////////////////////////////////////////////////
3 | // //
4 | // "Dynamic Object GF.E (16, 4) 69/71" by Vladimir Bonačić //
5 | // //
6 | // ( untitled 2 ) //
7 | // //
8 | ////////////////////////////////////////////////////////////////////////
9 |
10 | // The dynamic object is a 32 x 32 display.
11 | // It visualizes objects from abstract algebra,
12 | // which are known as Galois groups.
13 |
14 | // Source:
15 | // "Research and Teaching in Art and Science" by Vladimir Bonačić
16 | // Computer Graphics and Art Vol. 2, No. 3 pp. 4-8
17 |
18 | // See also:
19 | // "Kinetic Art: Application of Abstract Algebra to Objects with Computer-
20 | // Controlled Flashing Lights and Sound Combinations" by Vladimir Bonačić
21 | // Leonardo, Vol. 7, No. 3
22 | // Note: This paper is quite mathematical at times.
23 | // The implementation however is actually really simple.
24 |
25 |
26 | ///////////////////////////// UNTITLED 2 ///////////////////////////////
27 |
28 | // this sketch simply creates the 4 patterns of the 2nd image
29 | // in the article from the pattern presets given below.
30 |
31 | // Press any key to switch between patterns
32 |
33 | long[] preset = { 4294967295l, 100675584l, 2146959392l, 4293918847l };
34 |
35 | int d = 1<<5; // cells per dimension
36 | int led = 10; // size of the light bulb
37 | int w = led * d + 1; // display size
38 | int p = 0;
39 |
40 | void setup() {
41 | size(w, w);
42 | }
43 |
44 | void draw() {
45 | background(0);
46 | for(int y = 0; y < d; y++) {
47 | for(int x = 0; x < d; x++) {
48 | if( (1l<<(x^y) & preset[p] ) > 0) {
49 | rect(led * x, led * y, led, led);
50 | }
51 | }
52 | }
53 | }
54 |
55 | void keyPressed() {
56 | p = (p + 1) % preset.length;
57 | }
58 |
--------------------------------------------------------------------------------
/martin_schneider/untitled_3/untitled_3.pde:
--------------------------------------------------------------------------------
1 |
2 | // This sketch is part of the ReCode Project - http://recodeproject.com
3 |
4 | ////////////////////////////////////////////////////////////////////////
5 | // //
6 | // "Dynamic Object GF.E (16, 4) 69/71" by Vladimir Bonačić //
7 | // //
8 | // ( untitled 3 ) //
9 | // //
10 | ////////////////////////////////////////////////////////////////////////
11 |
12 | // (c) Martin Schneider 2012
13 |
14 | // Creative Commons license CC BY-SA 3.0
15 |
16 | // The dynamic object is a 32 x 32 display.
17 | // It visualizes objects from abstract algebra,
18 | // which are known as Galois groups.
19 |
20 | // Source:
21 | // "Research and Teaching in Art and Science" by Vladimir Bonačić
22 | // Computer Graphics and Art Vol. 2, No. 3 pp. 4-8
23 |
24 | // See also:
25 | // "Kinetic Art: Application of Abstract Algebra to Objects with Computer-
26 | // Controlled Flashing Lights and Sound Combinations" by Vladimir Bonačić
27 | // Leonardo, Vol. 7, No. 3
28 | // Note: This paper is quite mathematical at times.
29 | // The implementation however is actually really simple.
30 |
31 |
32 | ///////////////////////////// UNTITLED 2 ///////////////////////////////
33 |
34 | // this sketch simply creates the 4 patterns of the 3rd image
35 | // in the article from the pattern presets given below.
36 |
37 | // Press any key to switch between patterns
38 |
39 | long[] preset = { 196632, 25362456l , 143654784, 4278196223l };
40 |
41 | int d = 1<<5; // cells per dimension
42 | int led = 10; // size of the light bulb
43 | int w = led * d + 1; // display size
44 | int p = 0;
45 |
46 | void setup() {
47 | size(w, w);
48 | }
49 |
50 | void draw() {
51 | background(0);
52 | for(int y = 0; y < d; y++) {
53 | for(int x = 0; x < d; x++) {
54 | if( (1l<<(x^y) & preset[p] ) > 0) {
55 | rect(led * x, led * y, led, led);
56 | }
57 | }
58 | }
59 | }
60 |
61 | void keyPressed() {
62 | p = (p + 1) % preset.length;
63 | }
64 |
--------------------------------------------------------------------------------
/mary_scahill/kubusSerie/kubusSerie.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol1 no2 pg 27, 1976
3 | // by Klaus Basset
4 | // "Kubus-Serie"
5 | //
6 | // Mary Scahill
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 |
11 | // these values refer to the overal height of each row and column of the grid
12 | int rowHeight = 9;
13 | int colWidth = 7;
14 | //these arrays store the necessary translation values for each cube
15 | int[] transX = {14,17,-17, 17, -26, 17, -17, 17};
16 | int[] transY = {13, 0, 17, 0, -26, 0, 17, 0};
17 |
18 | void setup(){
19 | size(387, 479);
20 | background(255);
21 | stroke(0);
22 | strokeWeight(1);
23 | }
24 |
25 | void draw() {
26 | fill(255);
27 |
28 | //calls upon function for drawing a rectangle of ellipses
29 | ellipseRect(7,9,width-14,height-18);
30 |
31 | for(int i = 0; i < 8; i++) {
32 | translate(transX[i]*colWidth,transY[i]*rowHeight);
33 | fill(255);
34 | noStroke();
35 | rect(-2,-4,91,117);//this is just here so that the cross texture will be opaque
36 | stroke(0);
37 | crossRect(0,0,91,117);//draws crosses(or plus signs) on top of white rectangles
38 | parallelDashEllipse(91,0,49,126);//draws dashes within ellipses in parallelogram
39 | parallelCrossEllipse(7,117,84,63);//draws crosses within ellipses in parallelogram
40 | }
41 | }
42 |
43 | //funstion for drawing cross
44 | void drawCross(int xPos, int yPos, int lineLength) {
45 | int lineAx = xPos - int(lineLength/2);
46 | int lineAx2 = xPos + int(lineLength/2);
47 | int lineBy = yPos - int(lineLength/2);
48 | int lineBy2 = yPos + int(lineLength/2);
49 | line(lineAx, yPos, lineAx2, yPos);
50 | line(xPos, lineBy, xPos, lineBy2);
51 | }
52 |
53 | //function for drawing dash
54 | void drawDash(int xPos, int yPos, int lineLength) {
55 | int lineAx = xPos - int(lineLength/2);
56 | int lineAx2 = xPos + int(lineLength/2);
57 | line(lineAx, yPos, lineAx2, yPos);
58 | }
59 |
60 | //function for drawing a rectangle filled with crosses
61 | void crossRect(int xPos, int yPos, int rectWidth, int rectHeight) {
62 | for (int i = xPos; i < xPos + rectWidth; i+=7) {
63 | for (int j = yPos; j < yPos + rectHeight; j+=9) {
64 | drawCross(i,j,4);
65 | }
66 | }
67 | }
68 |
69 | //function for drawing rectangle filled with dashes
70 | void dashRect(int xPos, int yPos, int rectWidth, int rectHeight) {
71 | for (int i = xPos; i < xPos + rectWidth; i+=7) {
72 | for (int j = yPos; j < yPos + rectHeight; j+=9) {
73 | drawDash(i,j,4);
74 | }
75 | }
76 | }
77 |
78 | //function for drawing rectangle filled with ellipses
79 | void ellipseRect(int xPos, int yPos, int rectWidth, int rectHeight) {
80 | fill(255);
81 | for (int i = xPos; i < xPos + rectWidth; i+=7) {
82 | for (int j = yPos; j < yPos + rectHeight; j+=9) {
83 | ellipse(i,j,7, 7);
84 | }
85 | }
86 | }
87 |
88 | //function for drawing parallelogram filled with ellipses
89 | void parallelEllipse(int xPos, int yPos, int paraWidth, int sideHeight) {
90 | fill(255);
91 | int h = 0;
92 | for(int i = 0; i < paraWidth; i+=7) {
93 | for(int j = h; j < sideHeight + h; j+=9) {
94 | ellipse(xPos + i, yPos + j, 7, 7);
95 | }
96 | h+=9;
97 | }
98 | }
99 |
100 | //function for drawing parallelogram filled with crosses
101 | void parallelCross(int xPos, int yPos, int paraWidth, int sideHeight) {
102 | fill(255);
103 | int h = 0;
104 | for(int i = 0; i < paraWidth; i+=7) {
105 | for(int j = h; j < sideHeight + h; j+=9) {
106 | drawCross(xPos + i, yPos + j, 4);
107 | }
108 | h+=9;
109 | }
110 | }
111 |
112 | //function for drawing parallelogram filled with dashes
113 | void parallelDash(int xPos, int yPos, int paraWidth, int sideHeight) {
114 | int h = 0;
115 | for(int i = 0; i < paraWidth; i+=7) {
116 | for(int j = h; j < sideHeight + h; j+=9) {
117 | drawDash(xPos + i, yPos + j, 4);
118 | }
119 | h+=9;
120 | }
121 | }
122 |
123 | //function for drawing parallelogram filled with crosses and ellipses
124 | void parallelCrossEllipse(int xPos, int yPos, int paraWidth, int sideHeight) {
125 | fill(255);
126 | int h = 0;
127 | int m = 0;
128 | for(int i = h; i < sideHeight; i+=9) {
129 | for(int j = 0; j < paraWidth ; j+=7) {
130 | ellipse(xPos+h+j, yPos + i, 7, 7);
131 | drawCross(xPos +h+j, yPos + i, 4);
132 | }
133 | h+=7;
134 | }
135 |
136 | }
137 |
138 | //function for drawing parallelogram filled with dashed and ellipses
139 | void parallelDashEllipse(int xPos, int yPos, int paraWidth, int sideHeight) {
140 | fill(255);
141 | int h = 0;
142 | for(int i = 0; i < paraWidth; i+=7) {
143 | for(int j = h; j < sideHeight + h; j+=9) {
144 | ellipse(xPos + i, yPos + j, 7, 7);
145 | drawDash(xPos + i, yPos + j, 4);
146 | }
147 | h+=9;
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/michael_price/Zup_Tze/Zup_Tze.pde:
--------------------------------------------------------------------------------
1 | static final int LINE_WIDTH = 1;
2 |
3 | void setup() {
4 | size(512,512);
5 | }
6 |
7 | // Draws a single cross.
8 | void drawCross(int left, int top, int dim, int thickness) {
9 | int offset_1 = dim/2 - thickness/2;
10 | int offset_2 = offset_1 + thickness;
11 | int offset_3 = dim;
12 | beginShape();
13 | vertex(left + offset_1, top);
14 | vertex(left + offset_2, top);
15 | vertex(left + offset_2, top + offset_1);
16 | vertex(left + offset_3, top + offset_1);
17 | vertex(left + offset_3, top + offset_2);
18 | vertex(left + offset_2, top + offset_2);
19 | vertex(left + offset_2, top + offset_3);
20 | vertex(left + offset_1, top + offset_3);
21 | vertex(left + offset_1, top + offset_2);
22 | vertex(left, top + offset_2);
23 | vertex(left, top + offset_1);
24 | vertex(left + offset_1, top + offset_1);
25 | vertex(left + offset_1, top);
26 | endShape(CLOSE);
27 | }
28 |
29 | // Draw a stack of crosses.
30 | void drawCrossWithDecay(int left, int top, int base_dim, int num_decay,
31 | PVector dpos, int ddim, double dthickness) {
32 | double thickness = base_dim/3;
33 | int dim = base_dim;
34 | int curleft = left;
35 | int curtop = top;
36 | for (int i = 0; i < num_decay; i++) {
37 | drawCross(curleft, curtop, dim, (int)thickness);
38 | curleft += dpos.x + ddim/2;
39 | curtop += dpos.y + ddim/2;
40 | dim -= ddim;
41 | thickness -= dthickness;
42 | }
43 | }
44 |
45 | void drawCrossMatrix(int dim, int left, int top, int rows, int cols) {
46 | int thickness = dim/3;
47 | PVector dp1 = new PVector(0,-1);
48 | PVector dp2 = new PVector(1,0);
49 | PVector dp;
50 | for (int i = 0; i < rows; i++) {
51 | int rleft = left + i * thickness;
52 | int rtop = top + i * 2 * thickness;
53 | for (int j = 0; j < cols; j++) {
54 | dp = i%2==0?dp1:dp2;
55 | dp.mult(-1);
56 | drawCrossWithDecay(rleft + thickness * 2 *j, rtop - thickness * j, dim, 5, dp, 4, 4.5);
57 | }
58 | }
59 | }
60 |
61 | void draw() {
62 | background(0xffffff);
63 | drawCrossMatrix(69, 50, 150, 6, 6);
64 | }
65 |
--------------------------------------------------------------------------------
/michael_price/creature_tunnel/animals.pde:
--------------------------------------------------------------------------------
1 | final float[][] GOOSE =
2 | {{0.53515625,0.14648438},
3 | {0.56640625,0.14648438},
4 | {0.5839844,0.17382812},
5 | {0.5800781,0.19335938},
6 | {0.5644531,0.20507812},
7 | {0.5625,0.22070312},
8 | {0.5644531,0.23632812},
9 | {0.5761719,0.24414062},
10 | {0.5878906,0.27148438},
11 | {0.58984375,0.2890625},
12 | {0.5683594,0.30664062},
13 | {0.5546875,0.3203125},
14 | {0.5546875,0.34375},
15 | {0.5546875,0.37109375},
16 | {0.5703125,0.37695312},
17 | {0.5839844,0.3984375},
18 | {0.5839844,0.41601562},
19 | {0.5839844,0.4375},
20 | {0.60546875,0.44726562},
21 | {0.6308594,0.44335938},
22 | {0.6582031,0.41210938},
23 | {0.7167969,0.38085938},
24 | {0.7734375,0.37695312},
25 | {0.79296875,0.38671875},
26 | {0.82421875,0.40039062},
27 | {0.8652344,0.42382812},
28 | {0.8984375,0.46679688},
29 | {0.9316406,0.49023438},
30 | {0.953125,0.515625},
31 | {0.9589844,0.52734375},
32 | {0.9589844,0.55078125},
33 | {0.9355469,0.5683594},
34 | {0.91015625,0.5703125},
35 | {0.8730469,0.56640625},
36 | {0.84375,0.5566406},
37 | {0.83203125,0.55078125},
38 | {0.81640625,0.5761719},
39 | {0.796875,0.5878906},
40 | {0.79296875,0.58203125},
41 | {0.7753906,0.5527344},
42 | {0.7558594,0.55078125},
43 | {0.71875,0.56640625},
44 | {0.71875,0.57421875},
45 | {0.7050781,0.5878906},
46 | {0.67578125,0.5957031},
47 | {0.65625,0.5703125},
48 | {0.65625,0.5683594},
49 | {0.6308594,0.5839844},
50 | {0.62890625,0.5859375},
51 | {0.6230469,0.6171875},
52 | {0.6269531,0.6542969},
53 | {0.6542969,0.6816406},
54 | {0.66796875,0.7011719},
55 | {0.6777344,0.7246094},
56 | {0.67578125,0.7441406},
57 | {0.65234375,0.7441406},
58 | {0.62890625,0.734375},
59 | {0.60546875,0.7421875},
60 | {0.609375,0.7636719},
61 | {0.6035156,0.796875},
62 | {0.5839844,0.81640625},
63 | {0.5625,0.8300781},
64 | {0.5234375,0.83203125},
65 | {0.49414062,0.8105469},
66 | {0.49414062,0.7832031},
67 | {0.49414062,0.7597656},
68 | {0.47851562,0.7578125},
69 | {0.46484375,0.7792969},
70 | {0.40625,0.7871094},
71 | {0.3984375,0.7714844},
72 | {0.3984375,0.7480469},
73 | {0.41992188,0.7050781},
74 | {0.43359375,0.6816406},
75 | {0.47070312,0.65234375},
76 | {0.48046875,0.6425781},
77 | {0.46289062,0.5957031},
78 | {0.453125,0.5859375},
79 | {0.42382812,0.5859375},
80 | {0.39257812,0.609375},
81 | {0.3671875,0.59375},
82 | {0.328125,0.59375},
83 | {0.3125,0.6074219},
84 | {0.3046875,0.625},
85 | {0.2734375,0.63671875},
86 | {0.25585938,0.63671875},
87 | {0.22265625,0.6171875},
88 | {0.19335938,0.6113281},
89 | {0.171875,0.62890625},
90 | {0.15234375,0.6464844},
91 | {0.140625,0.6640625},
92 | {0.115234375,0.6425781},
93 | {0.091796875,0.62890625},
94 | {0.068359375,0.625},
95 | {0.046875,0.60546875},
96 | {0.0625,0.5917969},
97 | {0.103515625,0.5449219},
98 | {0.14257812,0.5136719},
99 | {0.19335938,0.45507812},
100 | {0.28320312,0.39453125},
101 | {0.34375,0.390625},
102 | {0.39257812,0.40820312},
103 | {0.42773438,0.43945312},
104 | {0.45898438,0.45507812},
105 | {0.48828125,0.46679688},
106 | {0.5019531,0.46679688},
107 | {0.50390625,0.46679688},
108 | {0.5097656,0.4453125},
109 | {0.5097656,0.421875},
110 | {0.5097656,0.37695312},
111 | {0.51171875,0.34960938},
112 | {0.5292969,0.33398438},
113 | {0.5175781,0.31835938},
114 | {0.5019531,0.30078125},
115 | {0.49414062,0.2734375},
116 | {0.49804688,0.24414062},
117 | {0.5097656,0.234375},
118 | {0.51953125,0.22265625},
119 | {0.51953125,0.203125},
120 | {0.51171875,0.1953125},
121 | {0.5058594,0.16601562},
122 | {0.5058594,0.14648438},
123 | {0.51953125,0.1328125},
124 | {0.5390625,0.12695312},
125 | {0.5488281,0.12695312}};
126 |
127 | final float[][] BEAVER =
128 | {{0.45117188,0.037109375},
129 | {0.49414062,0.048828125},
130 | {0.5527344,0.107421875},
131 | {0.5839844,0.15429688},
132 | {0.5839844,0.171875},
133 | {0.6074219,0.16796875},
134 | {0.6425781,0.16796875},
135 | {0.66796875,0.13867188},
136 | {0.6777344,0.16015625},
137 | {0.6972656,0.17382812},
138 | {0.6738281,0.18359375},
139 | {0.6953125,0.203125},
140 | {0.6699219,0.20898438},
141 | {0.6542969,0.203125},
142 | {0.6074219,0.2421875},
143 | {0.6171875,0.27929688},
144 | {0.63671875,0.29296875},
145 | {0.6464844,0.3046875},
146 | {0.6542969,0.3359375},
147 | {0.640625,0.39453125},
148 | {0.640625,0.4140625},
149 | {0.7109375,0.44335938},
150 | {0.7480469,0.41796875},
151 | {0.7421875,0.43945312},
152 | {0.7597656,0.45117188},
153 | {0.7441406,0.45898438},
154 | {0.7636719,0.47460938},
155 | {0.7441406,0.48242188},
156 | {0.7402344,0.50390625},
157 | {0.7050781,0.4765625},
158 | {0.66796875,0.46289062},
159 | {0.6171875,0.47265625},
160 | {0.59765625,0.48828125},
161 | {0.5859375,0.49804688},
162 | {0.56640625,0.5058594},
163 | {0.5605469,0.5234375},
164 | {0.56640625,0.5546875},
165 | {0.5996094,0.6386719},
166 | {0.62109375,0.703125},
167 | {0.66796875,0.77734375},
168 | {0.6777344,0.8105469},
169 | {0.63671875,0.9042969},
170 | {0.5546875,0.9511719},
171 | {0.49609375,0.9511719},
172 | {0.453125,0.921875},
173 | {0.421875,0.8671875},
174 | {0.40625,0.8203125},
175 | {0.40820312,0.7949219},
176 | {0.41992188,0.7578125},
177 | {0.42382812,0.7011719},
178 | {0.43554688,0.65234375},
179 | {0.44335938,0.6269531},
180 | {0.45117188,0.5859375},
181 | {0.45898438,0.55078125},
182 | {0.46289062,0.5234375},
183 | {0.45703125,0.5078125},
184 | {0.41992188,0.48828125},
185 | {0.38867188,0.484375},
186 | {0.34765625,0.49023438},
187 | {0.32421875,0.49804688},
188 | {0.30273438,0.5},
189 | {0.29101562,0.51171875},
190 | {0.28125,0.53125},
191 | {0.25585938,0.5214844},
192 | {0.25390625,0.50390625},
193 | {0.24023438,0.4921875},
194 | {0.23632812,0.47851562},
195 | {0.25390625,0.4765625},
196 | {0.27148438,0.47070312},
197 | {0.29101562,0.4765625},
198 | {0.30859375,0.46679688},
199 | {0.33007812,0.45117188},
200 | {0.34765625,0.4296875},
201 | {0.34179688,0.40625},
202 | {0.33398438,0.37695312},
203 | {0.33398438,0.33984375},
204 | {0.33398438,0.3046875},
205 | {0.33984375,0.2734375},
206 | {0.34179688,0.24804688},
207 | {0.33007812,0.234375},
208 | {0.30859375,0.2265625},
209 | {0.28710938,0.21679688},
210 | {0.27539062,0.21875},
211 | {0.25,0.22460938},
212 | {0.265625,0.2109375},
213 | {0.265625,0.18945312},
214 | {0.26757812,0.17578125},
215 | {0.26953125,0.1640625},
216 | {0.2890625,0.16992188},
217 | {0.28710938,0.18945312},
218 | {0.3046875,0.1953125},
219 | {0.3203125,0.1953125},
220 | {0.34375,0.19140625},
221 | {0.36914062,0.18164062},
222 | {0.38085938,0.1875},
223 | {0.36914062,0.16992188},
224 | {0.3671875,0.15820312},
225 | {0.36914062,0.140625},
226 | {0.38085938,0.123046875},
227 | {0.40429688,0.109375},
228 | {0.41601562,0.091796875},
229 | {0.43164062,0.064453125},
230 | {0.44921875,0.05078125},
231 | {0.46679688,0.044921875},
232 | {0.49414062,0.05859375},
233 | {0.5097656,0.07421875}};
234 |
235 | final float[][] FROG =
236 | {{0.5292969,0.03125},
237 | {0.5625,0.037109375},
238 | {0.6308594,0.0859375},
239 | {0.6660156,0.15625},
240 | {0.640625,0.125},
241 | {0.609375,0.123046875},
242 | {0.56640625,0.15820312},
243 | {0.5722656,0.1953125},
244 | {0.6035156,0.22460938},
245 | {0.6347656,0.22851562},
246 | {0.6660156,0.18945312},
247 | {0.6933594,0.2421875},
248 | {0.7519531,0.23632812},
249 | {0.7910156,0.18554688},
250 | {0.796875,0.24023438},
251 | {0.83203125,0.23046875},
252 | {0.8066406,0.265625},
253 | {0.8378906,0.3046875},
254 | {0.7890625,0.28710938},
255 | {0.79296875,0.31445312},
256 | {0.76171875,0.265625},
257 | {0.6933594,0.296875},
258 | {0.6152344,0.5058594},
259 | {0.7441406,0.58984375},
260 | {0.7597656,0.7597656},
261 | {0.6230469,0.7890625},
262 | {0.7167969,0.8671875},
263 | {0.6699219,0.8886719},
264 | {0.6699219,0.9277344},
265 | {0.64453125,0.9355469},
266 | {0.60546875,0.90625},
267 | {0.5917969,0.9355469},
268 | {0.5527344,0.7714844},
269 | {0.5761719,0.7480469},
270 | {0.65234375,0.7050781},
271 | {0.5878906,0.6875},
272 | {0.5214844,0.6386719},
273 | {0.50390625,0.55078125},
274 | {0.47851562,0.62109375},
275 | {0.45507812,0.6621094},
276 | {0.33984375,0.68359375},
277 | {0.33789062,0.69140625},
278 | {0.4296875,0.765625},
279 | {0.38085938,0.9238281},
280 | {0.375,0.91015625},
281 | {0.36523438,0.9003906},
282 | {0.3046875,0.9121094},
283 | {0.30078125,0.8691406},
284 | {0.27734375,0.8515625},
285 | {0.26953125,0.8515625},
286 | {0.2578125,0.83203125},
287 | {0.36132812,0.78125},
288 | {0.34179688,0.7636719},
289 | {0.22851562,0.7363281},
290 | {0.25195312,0.58203125},
291 | {0.27539062,0.5449219},
292 | {0.3984375,0.49414062},
293 | {0.36328125,0.28710938},
294 | {0.29101562,0.24609375},
295 | {0.25390625,0.28320312},
296 | {0.24804688,0.27148438},
297 | {0.23242188,0.26367188},
298 | {0.1875,0.2734375},
299 | {0.22070312,0.24023438},
300 | {0.21484375,0.20898438},
301 | {0.24023438,0.203125},
302 | {0.25585938,0.15820312},
303 | {0.27148438,0.18359375},
304 | {0.28710938,0.20703125},
305 | {0.34570312,0.22265625},
306 | {0.37890625,0.1640625},
307 | {0.38867188,0.18554688},
308 | {0.40820312,0.22070312},
309 | {0.44335938,0.23046875},
310 | {0.4609375,0.21679688},
311 | {0.47460938,0.18164062},
312 | {0.48046875,0.15625},
313 | {0.4609375,0.12890625},
314 | {0.4375,0.12109375},
315 | {0.40429688,0.115234375},
316 | {0.38671875,0.13867188},
317 | {0.41015625,0.0859375},
318 | {0.45898438,0.056640625},
319 | {0.49804688,0.0390625},
320 | {0.5390625,0.03125}};
321 |
322 | final float[][] ECHIDNA =
323 | {{0.50390625,0.046875},
324 | {0.47851562,0.072265625},
325 | {0.47070312,0.099609375},
326 | {0.484375,0.20703125},
327 | {0.48632812,0.22851562},
328 | {0.45898438,0.23828125},
329 | {0.43945312,0.26367188},
330 | {0.42773438,0.2890625},
331 | {0.42578125,0.31835938},
332 | {0.44335938,0.34765625},
333 | {0.46484375,0.359375},
334 | {0.4765625,0.375},
335 | {0.47265625,0.38476562},
336 | {0.44726562,0.359375},
337 | {0.39648438,0.32421875},
338 | {0.37304688,0.31054688},
339 | {0.34375,0.28710938},
340 | {0.31640625,0.29296875},
341 | {0.30273438,0.30859375},
342 | {0.2734375,0.33789062},
343 | {0.26757812,0.37109375},
344 | {0.27148438,0.4140625},
345 | {0.29101562,0.43945312},
346 | {0.31054688,0.44335938},
347 | {0.33984375,0.45703125},
348 | {0.37109375,0.45898438},
349 | {0.39257812,0.45703125},
350 | {0.328125,0.48046875},
351 | {0.28710938,0.49414062},
352 | {0.25585938,0.5644531},
353 | {0.23046875,0.62890625},
354 | {0.23242188,0.6816406},
355 | {0.25,0.75},
356 | {0.29882812,0.7890625},
357 | {0.3125,0.8105469},
358 | {0.30664062,0.8457031},
359 | {0.31054688,0.8925781},
360 | {0.33789062,0.9199219},
361 | {0.41796875,0.8769531},
362 | {0.44921875,0.88671875},
363 | {0.48828125,0.9277344},
364 | {0.50390625,0.9667969},
365 | {0.5332031,0.9140625},
366 | {0.5957031,0.890625},
367 | {0.6386719,0.88671875},
368 | {0.66796875,0.9121094},
369 | {0.6894531,0.8886719},
370 | {0.7050781,0.8613281},
371 | {0.6953125,0.8183594},
372 | {0.76171875,0.75},
373 | {0.765625,0.7109375},
374 | {0.765625,0.6503906},
375 | {0.7265625,0.5605469},
376 | {0.6875,0.51953125},
377 | {0.6171875,0.49414062},
378 | {0.67578125,0.48046875},
379 | {0.71484375,0.48046875},
380 | {0.73828125,0.44726562},
381 | {0.7324219,0.39257812},
382 | {0.7011719,0.35351562},
383 | {0.63671875,0.3515625},
384 | {0.57421875,0.3515625},
385 | {0.5390625,0.38671875},
386 | {0.5683594,0.33789062},
387 | {0.59765625,0.32617188},
388 | {0.6074219,0.30664062},
389 | {0.58203125,0.26953125},
390 | {0.55078125,0.24023438},
391 | {0.5390625,0.21875},
392 | {0.53515625,0.16796875},
393 | {0.5371094,0.13671875},
394 | {0.5371094,0.095703125},
395 | {0.51953125,0.0546875},
396 | {0.50390625,0.046875}};
397 |
398 | final float[][][] ANIMALS = {GOOSE, FROG, BEAVER, ECHIDNA};
399 |
--------------------------------------------------------------------------------
/michael_price/creature_tunnel/creature_tunnel.pde:
--------------------------------------------------------------------------------
1 | void setup() {
2 | size(512,512);
3 | }
4 |
5 | final float BASE_ANIMAL_SCALE = 100.0;
6 | final float TUNNEL_RADIUS = 50;
7 |
8 | void drawAnimal(float[][] pts) {
9 | beginShape();
10 | for(int i = 0; i < pts.length; i++) {
11 | vertex(BASE_ANIMAL_SCALE*pts[i][0] - BASE_ANIMAL_SCALE/2,
12 | BASE_ANIMAL_SCALE*pts[i][1] - BASE_ANIMAL_SCALE/2);
13 | }
14 | endShape(CLOSE);
15 | }
16 |
17 | void transformToTunnelPoint() {
18 | float theta, zz, r, dx, dy, tx, ty, tunneldist;
19 | do {
20 | theta = random(TWO_PI);
21 | // Bastardization of perspective transform.
22 | zz = random(5) + 1.0;
23 | r = height/2 + TUNNEL_RADIUS;
24 | dx = r * cos(theta) / zz;
25 | dy = r * sin(theta) / zz;
26 | tx = width/2 + dx;
27 | ty = height/2 + dy;
28 | tunneldist = sqrt(dx*dx + dy*dy);
29 | // Rejection sampling.
30 | } while (tunneldist < TUNNEL_RADIUS);
31 |
32 | translate(tx, ty);
33 |
34 | float persp = (tunneldist - TUNNEL_RADIUS + 25) / (height/2);
35 | // Persepective attentuation.
36 | float angle = atan2(dy, dx);
37 | rotate(angle);
38 | scale(min(1.0,persp*persp*persp*2), min(1.0,persp));
39 | rotate(-angle);
40 |
41 | // Random rotation.
42 | rotate(random(2*PI));
43 | }
44 |
45 | void draw() {
46 | background(0xffffff);
47 | fill(0,0,0,0);
48 | for (int i = 0; i < 300; i++) {
49 | pushMatrix();
50 | transformToTunnelPoint();
51 | drawAnimal(ANIMALS[floor(random(ANIMALS.length))]);
52 | popMatrix();
53 | }
54 | noLoop();
55 | }
56 |
--------------------------------------------------------------------------------
/mitchell_whitelaw/sykora_reCode/sykora_reCode.pde:
--------------------------------------------------------------------------------
1 |
2 | // This sketch is part of the ReCode Project - http://recodeproject.com
3 | //
4 | // From Computer Graphics and Art vol1 no2 pg 17
5 | // by Zdenek Sykora
6 | // "Structure"
7 |
8 | // Mitchell Whitelaw
9 | // 2012
10 | // Creative Commons license CC BY-SA 3.0
11 |
12 | int moduledim = 40;
13 | int gridwidth = 11;
14 | int gridheight = 22;
15 |
16 | void setup(){
17 | size(440,880);
18 | smooth();
19 | noLoop();
20 | ellipseMode(CENTER);
21 | }
22 |
23 |
24 | void draw(){
25 | noStroke();
26 | translate(moduledim/2,moduledim/2);
27 | for (int i=0; i< gridwidth; i++){
28 | for (int j=0; j< gridheight; j++){
29 | sykoraModule(int(random(2)),int(random(3)),int(random(4)),i,j);
30 | }
31 | }
32 | }
33 |
34 |
35 | void sykoraModule( int polarity, int composition, int orientation, int gridx, int gridy) {
36 | pushMatrix();
37 | translate(gridx*moduledim,gridy*moduledim);
38 | rotate(orientation*TWO_PI/4.0);
39 | translate(-moduledim/2, -moduledim/2);
40 |
41 | fill(polarity*255); // bg fill
42 | rect(0,0, moduledim, moduledim); // bg square
43 |
44 | fill(abs(polarity-1)*255); // reverse the fill
45 |
46 | arc(moduledim/2, 0, moduledim, moduledim, 0, PI); // composition == 0; first arc
47 |
48 | if (composition == 1){ // more arcs
49 | arc(moduledim/2, moduledim/2, moduledim, moduledim, 0, PI); // second arc (aligned)
50 | } else if (composition == 2){
51 | arc(moduledim/2, moduledim, moduledim, moduledim, PI, TWO_PI); // second arc (mirrored);
52 | }
53 | popMatrix();
54 | }
55 |
56 |
57 |
58 | void mousePressed(){
59 | redraw();
60 | }
61 |
62 |
63 |
--------------------------------------------------------------------------------
/nick_santaniello/crosses/Cross.pde:
--------------------------------------------------------------------------------
1 | class Cross {
2 |
3 | int baseW = 40;
4 | int baseH = 120;
5 | int sizeDifference = 8;
6 | int x;
7 | int y;
8 | int offset = 2;
9 |
10 | Cross(int xVal, int yVal) {
11 | x = xVal;
12 | y = yVal;
13 | };
14 |
15 | void display() {
16 |
17 | //I draw each cross as two intersecting rectangles.
18 | //By drawing two rectangles and a small white square in the middle, I can leverage rectMode(CENTER) as opposed to maintaining 12 seperate line segments per cross. This is my justification for this hack.
19 |
20 | rect(x, y, baseW, baseH);
21 | rect(x, y, baseH, baseW);
22 | //draw the white box
23 | stroke(255);
24 | rect(x, y, baseW, baseW);
25 | stroke(0);
26 |
27 | //draw 4 crosses inside each cross.
28 | for (int i = 1; i<=4; i++) {
29 | int w = baseW - i*sizeDifference;
30 | int h = baseH - i*sizeDifference;
31 | rect(x, y+offset*i, w, h);
32 | rect(x, y+offset*i, h, w);
33 | stroke(255);
34 | rect(x, y+offset*i, w, w);
35 | stroke(0);
36 | }
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/nick_santaniello/crosses/crosses.pde:
--------------------------------------------------------------------------------
1 | void setup() {
2 |
3 | size(800, 800);
4 | rectMode(CENTER);
5 | strokeWeight(2);
6 | // Create 36 crosses.
7 | Cross[] crosses;
8 | crosses = new Cross[36];
9 | translate(100, 300);
10 |
11 | //for every row...
12 | for (int r = 0; r<6; r++) {
13 | //for every column...
14 | for (int c = 0; c<6; c++) {
15 | pushMatrix();
16 | translate(80*c+r*40, -40*c + r*80);
17 |
18 | //rotate 180 degrees per column.
19 | rotate(PI* c);
20 |
21 | //rotate 90 degrees per row
22 | rotate(PI/2 * r);
23 |
24 | Cross newCross = new Cross(0, 0);
25 | newCross.display();
26 | popMatrix();
27 | }
28 | }
29 | }
30 |
31 | void draw() {
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/nick_santaniello/nubs/nubs.pde:
--------------------------------------------------------------------------------
1 | /*
2 | Part of the ReCode Project
3 | http://recodeproject.com
4 | Untitled 1 (Computer graphics at the University of Munich - West Germany)
5 | by Various (Reiner Schneeberger and unnamed students)
6 |
7 | See also Vol. 2 No. 3 (image 10, pages 14-15) for more, including code. Input to computer on punch cards
8 |
9 | Nick Santaniello
10 | 2012
11 | */
12 |
13 | int cols = 11;
14 | int rows = 10;
15 | int frmRate =60;
16 | int updateCounter =0 ;
17 | int sqSize= 100;
18 | int sizeDifference = 17;
19 | Nub[] nubs;
20 |
21 | void setup() {
22 | size(1000, 950);
23 |
24 | rectMode(CENTER);
25 | strokeWeight(2);
26 | fill(240);
27 | nubs = new Nub[110];
28 | for (int i=0; i<110; i++) {
29 | Nub newNub = new Nub();
30 | nubs[i] = newNub;
31 | }
32 |
33 | //for every row...
34 | for (int r = 0; r frmRate) {
69 | update();
70 | //reset the update counter
71 | updateCounter = 0;
72 | }
73 | }
74 |
75 | void update() {
76 | //saveFrame("nubs.jpg");
77 | for (int i=0; i<110; i++) {
78 | nubs[i].update();
79 | }
80 | }
81 |
82 | class Nub {
83 |
84 | int cols = 11;
85 | int rows = 10;
86 | float offsetX;
87 | float offsetY;
88 | float targetX;
89 | float targetY;
90 | int sqSize = 100;
91 | int sizeDifference = 17;
92 |
93 | Nub() {
94 |
95 | //define a starting offset for the Nub.
96 | offsetX = random(-7, 7);
97 | offsetY = random(-7, 7);
98 | };
99 |
100 | void run(int r, int c) {
101 |
102 | //A very primitive check. If the Nub has not reached its target, move it towards its target by 0.1 pixels per frame.
103 | if (offsetX != targetX) {
104 | if (offsetX < targetX) {
105 | offsetX = offsetX + 0.1;
106 | }
107 | if (offsetX > targetX) {
108 | offsetX = offsetX - 0.1;
109 | }
110 | }
111 | if (offsetY != targetY) {
112 | if (offsetY < targetY) {
113 | offsetY = offsetY + 0.1;
114 | }
115 | if (offsetY > targetY) {
116 | offsetY = offsetY - 0.1;
117 | }
118 | }
119 |
120 | //Draw the rectangle and 5 interior rectangles with the appropriate offset.
121 | rect(c*sqSize, r*sqSize, sqSize, sqSize);
122 | for (int i=1; i<6; i++) {
123 | rect((c*sqSize)+(i*offsetX), (r*sqSize)+(i*offsetY), sqSize - (i*sizeDifference), sqSize - (i*sizeDifference));
124 | }
125 | }
126 | void update() {
127 | //choose a new target offset for the Nub.
128 | targetX = random(-7, 7);
129 | targetY = random(-7, 7);
130 | }
131 | }
132 |
133 |
--------------------------------------------------------------------------------
/nick_santaniello/square_towers/square_towers.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol1 no4 pg 28
3 | // Untitled 1 (Computer graphics at the University of Munich - West Germany)
4 | // by Various (Reiner Schneeberger and unnamed students)
5 | //
6 | // Nick Santaniello
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | int cols = 11;
11 | int rows = 10;
12 | float offsetX;
13 | float offsetY;
14 | int sqSize= 100;
15 | int sizeDifference = 17;
16 |
17 | void setup() {
18 | size(1000, 1000);
19 | offsetX = random(-6, 6);
20 | offsetY = random(-6, 6);
21 | rectMode(CENTER);
22 | strokeWeight(2);
23 | fill(240);
24 |
25 | //for every row...
26 | for (int r = 0; r theLines;
20 |
21 | void setup() {
22 | size(564, 564);
23 | background(255);
24 | stroke(0);
25 | strokeWeight(2);
26 |
27 | theLines = new ArrayList();
28 | for (int i =0; i < 8; i++) {
29 | theLines.add(i);
30 | }
31 |
32 | drawAgain();
33 | }
34 |
35 | void drawAgain() {
36 |
37 | //for every row...
38 | for (int r =0; r < rows; r++) {
39 | //for every column...
40 | for (int c =0; c < cols; c++) {
41 | int x = boxSize*c + margin*c;
42 | int y = boxSize*r + margin*r;
43 |
44 | pushMatrix();
45 | translate(x, y);
46 | rect(0, 0, boxSize, boxSize);
47 |
48 | int targetDistance = max(abs(r - targetRow), abs(c-targetCol));
49 |
50 | // Default to max segments if box is far away
51 | if (targetDistance > 7) {
52 | targetDistance = 7;
53 | };
54 |
55 | // randomize possible lines
56 | Collections.shuffle(theLines);
57 | for (int i = 0; i < targetDistance; i++) {
58 | drawLine( theLines.get(i), boxSize, boxSize);
59 | }
60 |
61 | popMatrix();
62 | }
63 | }
64 | }
65 | void draw() {
66 |
67 | frameCounter++;
68 |
69 | if (frameCounter > moveRate) {
70 | switch (dir) {
71 | case 1:
72 | targetCol++;
73 | if (targetCol >= cols-3) {
74 | dir++;
75 | }
76 | break;
77 | case 2:
78 | targetRow++;
79 | if (targetRow >= rows-3) {
80 | dir++;
81 | }
82 | break;
83 | case 3:
84 | targetCol--;
85 | if (targetCol <= 2) {
86 | dir++;
87 | //saveFrame("structured_square.jpg");
88 | }
89 | break;
90 | case 4:
91 | targetRow--;
92 | if (targetRow <= 3) {
93 | dir = 1;
94 | }
95 | break;
96 | }
97 | drawAgain();
98 | frameCounter = 0;
99 | }
100 | }
101 |
102 |
103 | void drawLine(int whichLine, int w, int h) {
104 | switch(whichLine) {
105 | case 0:
106 | line(w, 0, 0, h);
107 | break;
108 | case 1:
109 | line(0, 0, w, h);
110 | break;
111 | case 2:
112 | line(0, h/2, w, h/2);
113 | break;
114 | case 3:
115 | line(0, h/2, w/2, 0);
116 | break;
117 | case 4:
118 | line(w/2, h, 0, h/2);
119 | break;
120 | case 5:
121 | line(w/2, 0, w/2, h);
122 | break;
123 | case 6:
124 | line(w/2, 0, w, h/2);
125 | break;
126 | case 7:
127 | line(w, h/2, w/2, h);
128 | break;
129 | }
130 | }
131 |
132 |
--------------------------------------------------------------------------------
/paul_may/wehrner/wehrner.pde:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | This sketch is part of the ReCode Project - http://recodeproject.com
4 | From Computer Graphics and Art vol3 no1 pg 5
5 | by E.T. Manning
6 |
7 | "Wehrner Von Braun", Photo of output of optical processor for spatial quantization. 24in x 18in
8 |
9 | Paul May
10 | 2012
11 | Creative Commons license CC BY-SA 3.0
12 |
13 | /* ---------------- GLOBALS ---------------------- */
14 |
15 | String sketchname = "wehrner";
16 | PImage original_img; //the original source image of Von Braun
17 |
18 | /*
19 | //full grey palette
20 | color[] allowed_colours = {
21 | #000000, #080808, #101010, #181818, #202020,
22 | #282828, #303030, #383838, #404040, #484848,
23 | #505050, #585858, #606060, #686868, #707070,
24 | #787878, #808080, #888888, #909090, #989898,
25 | #A0A0A0, #A8A8A8, #B0B0B0, #B8B8B8, #C0C0C0,
26 | #C8C8C8, #D0D0D0, #D8D8D8, #E0E0E0, #E8E8E8,
27 | #F0F0F0, #F8F8F8, #FFFFFF};
28 | */
29 |
30 | //reduced grey palette
31 | color[] allowed_colours = {
32 | #000000, #080808, #101010, #181818, #202020,
33 | #282828, #303030, #383838, #404040, #484848,
34 | #505050, #585858, #606060, #686868, #707070,
35 | #787878, #808080, #888888, #909090, #989898,
36 | #A0A0A0, #A8A8A8, #FFFFFF};
37 |
38 |
39 |
40 |
41 | /* ---------------- SETUP ---------------------- */
42 |
43 | void setup() {
44 | //size(1920, 1080); //FHD
45 | //size(1360, 768); //HD
46 | //size(1280,720); //720p
47 | //size(1093, 614); //QFHD
48 | size(800, 600); //4:3 low res
49 |
50 | /* What is Quantization?
51 |
52 | From WikiPedia "a process that reduces
53 | the number of distinct colors used in an image, usually with the intention that the new
54 | image should be as visually similar as possible to the original image. Computer algorithms
55 | to perform color quantization on bitmaps have been studied since the 1970s.
56 | Color quantization is critical for displaying images with many colors on devices that can only
57 | display a limited number of colors, usually due to memory limitations, and enables efficient
58 | compression of certain types of images."
59 |
60 | http://en.wikipedia.org/wiki/Color_quantization
61 |
62 | */
63 |
64 |
65 | /* Load original image.
66 |
67 | Image caption: Dr. Wernher von Braun in his Office - Dr. Wernher von Braun is in his office, with an artist's concept
68 | of a lunar lander in background and models of Mercury-Redstone, Juno, and Saturn I. Dr. Wernher von Braun, the first
69 | MSFC Director, led a team of German rocket scientists, called the Rocket Team, to the United States, first to
70 | Fort Bliss/White Sands, later being transferred to the Army Ballistic Missile Agency at Redstone Arsenal in Huntsville, Alabama.
71 | Image source: http://space.about.com/od/rocketrybiographies/ig/Wernher-von-Braun-Pictures-Gal/Wernher-von-Braun-in-Office.htm
72 | Image retrieved: November 17th 2012
73 |
74 | */
75 |
76 | original_img = loadImage("data/wehrner_resized.jpg");
77 | original_img.loadPixels();
78 |
79 | /* Now that we have the image,
80 | loop through each pizel of the image
81 | calculate the distance between the colour of that pizel and each of our allowed colours
82 | populate the pixel array of our quantized_img with the colour that is closest
83 | */
84 | //
85 | for (int x = 0; x < original_img.pixels.length ; x++) { // loop through each pixel of the image;
86 | float minDistance = 1000000;
87 | int minIndex = 10000;
88 | //original_img.pixels[x] = allowed_colours[floor(random(colours.length))]; //just a test, set the pixel to a random, allowed colour
89 | minDistance = 1000;
90 | minIndex = 0;
91 | for (int y = 0;y < allowed_colours.length;y++) {
92 | // calculate the distance between the colour of that pixel and each of our allowed colours
93 | float redDistance = red(allowed_colours[y])-red(original_img.pixels[x]);
94 | float greenDistance = green(allowed_colours[y])-green(original_img.pixels[x]);
95 | float blueDistance = blue(allowed_colours[y])-blue(original_img.pixels[x]);
96 | float colourDistance = abs(sqrt(redDistance+greenDistance+blueDistance));
97 | //is this the smallest distance we've seen?
98 | if (colourDistance < minDistance) {
99 | minDistance = colourDistance;
100 | minIndex = y;
101 | }
102 | }
103 | //set the colour of the pixel in the image to the colour in our allowed colours
104 | original_img.pixels[x] = allowed_colours[minIndex];
105 | }
106 | }
107 |
108 | /* ---------------- DRAW ---------------------- */
109 |
110 |
111 | void draw() {
112 | //map the size of the inputted image to our window size
113 | image(original_img, 0, 0, map(original_img.width, 0, original_img.width, 0, width), map(original_img.height, 0, original_img.height, 0, height));
114 | }
115 |
116 |
117 | /* ---------------- HANDY FUNCTIONS ---------------------- */
118 |
119 | void keyPressed() {
120 | switch(key) {
121 | case 's':
122 | screenShot();
123 | break;
124 | }
125 | }
126 |
127 | void screenShot() {
128 | //take a timestamped screenshot
129 | Date date = new Date();
130 | Format dateFormat;
131 | dateFormat = new SimpleDateFormat("dd.MM.yyyy_HH.mm.ss");
132 | String d = dateFormat.format(date);
133 | String fileName = "screenshots/"+d+"_"+millis()+"_"+sketchname+".png";
134 | save(fileName);
135 | println("took screenshot: "+fileName);
136 | }
137 |
138 |
--------------------------------------------------------------------------------
/quin_kennedy/recode__v3n2_untitled/recode__v3n2_untitled.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 30
3 | // by Roger Coqart
4 | //
5 | // Quin Kennedy
6 | // 2012
7 | // Creative Commons license CC BY-SA 3.0
8 |
9 | LineData[] tileData;
10 | //number selection inspired by version in PDF, not screenshot on website.
11 | static final int numTiles = 13;
12 | static final float gutterRelativeSize = .5;
13 | static final int windowSize = 600;
14 | //we need space for each tile,
15 | //space for each gutter to the left of each tile,
16 | //and space for the final gutter (to the right of the final tile)
17 | static final int tileSize = floor(windowSize/(numTiles*(1+gutterRelativeSize)+gutterRelativeSize));
18 | static final int gutterSize = floor(tileSize*gutterRelativeSize);
19 |
20 | void setup(){
21 | int actualWinSize = (tileSize+gutterSize)*numTiles+gutterSize;
22 | size(actualWinSize, actualWinSize);
23 | createTiles();
24 | noLoop();
25 | }
26 |
27 | void draw(){
28 | background(255);
29 | stroke(0);
30 | strokeWeight(2);
31 | strokeJoin(ROUND);
32 | noFill();
33 | //pick a random grid cell to be the focal point
34 | //for now we will restrict it to have at most one row/column of empty squares
35 | int focusX = floor(random(numTiles-9, 9));
36 | int focusY = floor(random(numTiles-9, 9));
37 | //for each grid cell...
38 | for(int i = 0, gi = gutterSize; i < numTiles; i++, gi += gutterSize+tileSize){
39 | for(int j = 0, gj = gutterSize; j < numTiles; j++, gj += gutterSize+tileSize){
40 | pushMatrix();
41 | translate(gi,gj);
42 | rect(0, 0, tileSize, tileSize);
43 | shuffleTiles();
44 | int num = max((tileData.length - max(abs(focusX-i), abs(focusY-j))), 0);
45 | for(int k = 0; k < num; k++){
46 | LineData td = tileData[k];
47 | line(td.sx, td.sy, td.ex, td.ey);
48 | }
49 | popMatrix();
50 | }
51 | }
52 | }
53 |
54 | void shuffleTiles(){
55 | for(int i = 0; i < tileData.length-1; i++){
56 | int swapWith = floor(random(i, tileData.length));
57 |
58 | LineData temp = tileData[i];
59 | tileData[i] = tileData[swapWith];
60 | tileData[swapWith] = temp;
61 | }
62 | }
63 |
64 | void createTiles(){
65 | //the two lines of the +
66 | //and the four lines of the square
67 | //and the two lines of the x
68 | int numTileTypes = 2+4+2;
69 | int i = 0;
70 | tileData = new LineData[numTileTypes];
71 | //two lines of the +
72 | tileData[i++] = new LineData(tileSize/2, 0, tileSize/2, tileSize);
73 | tileData[i++] = new LineData(0, tileSize/2, tileSize, tileSize/2);
74 | //four lines of the square
75 | tileData[i++] = new LineData(tileSize/2, 0, 0, tileSize/2);
76 | tileData[i++] = new LineData(0, tileSize/2, tileSize/2, tileSize);
77 | tileData[i++] = new LineData(tileSize/2, tileSize, tileSize, tileSize/2);
78 | tileData[i++] = new LineData(tileSize, tileSize/2, tileSize/2, 0);
79 | //two lines of the x
80 | tileData[i++] = new LineData(0, 0, tileSize, tileSize);
81 | tileData[i++] = new LineData(tileSize, 0, 0, tileSize);
82 | }
83 |
84 | class LineData{
85 | public float sx,sy,ex,ey;
86 | public LineData(float _sx, float _sy, float _ex, float _ey){
87 | sx = _sx;
88 | sy = _sy;
89 | ex = _ex;
90 | ey = _ey;
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/Krungthep-10.vlw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthewepler/ReCode_Project/d7d83ba39427d39f25951e587acbadfca68c83fe/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/Krungthep-10.vlw
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/Krungthep-12.vlw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthewepler/ReCode_Project/d7d83ba39427d39f25951e587acbadfca68c83fe/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/Krungthep-12.vlw
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/KufiStandardGK-10.vlw:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthewepler/ReCode_Project/d7d83ba39427d39f25951e587acbadfca68c83fe/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/KufiStandardGK-10.vlw
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/Universal Declaration of Human Rights.txt:
--------------------------------------------------------------------------------
1 | Universal Declaration of Human Rights (United Nations General Assembly - Dec 10, 1948) (1)All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood. (2)Everyone is entitled to all the rights and freedoms set forth in this Declaration, without distinction of any kind, such as race, colour, sex, language, religion, political or other opinion, national or social origin, property, birth or other status. Furthermore, no distinction shall be made on the basis of the political, jurisdictional or international status of the country or territory to which a person belongs, whether it be independent, trust, non-self-governing or under any other limitation of sovereignty. (3)Everyone has the right to life, liberty and security of person. (4)No one shall be held in slavery or servitude; slavery and the slave trade shall be prohibited in all their forms. (5)No one shall be subjected to torture or to cruel, inhuman or degrading treatment or punishment. (6)Everyone has the right to recognition everywhere as a person before the law. (7)All are equal before the law and are entitled without any discrimination to equal protection of the law. All are entitled to equal protection against any discrimination in violation of this Declaration and against any incitement to such discrimination. (8)Everyone has the right to an effective remedy by the competent national tribunals for acts violating the fundamental rights granted him by the constitution or by law. (9)No one shall be subjected to arbitrary arrest, detention or exile. (10)Everyone is entitled in full equality to a fair and public hearing by an independent and impartial tribunal, in the determination of his rights and obligations and of any criminal charge against him. (11)Everyone charged with a penal offence has the right to be presumed innocent until proved guilty according to law in a public trial at which he has had all the guarantees necessary for his defence. No one shall be held guilty of any penal offence on account of any act or omission which did not constitute a penal offence, under national or international law, at the time when it was committed. Nor shall a heavier penalty be imposed than the one that was applicable at the time the penal offence was committed. (12)No one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, nor to attacks upon his honour and reputation. Everyone has the right to the protection of the law against such interference or attacks. (13)Everyone has the right to freedom of movement and residence within the borders of each State. Everyone has the right to leave any country, including his own, and to return to his country. (14)Everyone has the right to seek and to enjoy in other countries asylum from persecution. This right may not be invoked in the case of prosecutions genuinely arising from non-political crimes or from acts contrary to the purposes and principles of the United Nations. (15)Everyone has the right to a nationality. No one shall be arbitrarily deprived of his nationality nor denied the right to change his nationality. (16)Men and women of full age, without any limitation due to race, nationality or religion, have the right to marry and to found a family. They are entitled to equal rights as to marriage, during marriage and at its dissolution. Marriage shall be entered into only with the free and full consent of the intending spouses. The family is the natural and fundamental group unit of society and is entitled to protection by society and the State. (17)Everyone has the right to own property alone as well as in association with others. No one shall be arbitrarily deprived of his property. (18)Everyone has the right to freedom of thought, conscience and religion; this right includes freedom to change his religion or belief, and freedom, either alone or in community with others and in public or private, to manifest his religion or belief in teaching, practice, worship and observance. (19)Everyone has the right to freedom of opinion and expression; this right includes freedom to hold opinions without interference and to seek, receive and impart information and ideas through any media and regardless of frontiers. (20)Everyone has the right to freedom of peaceful assembly and association. No one may be compelled to belong to an association. (21)Everyone has the right to take part in the government of his country, directly or through freely chosen representatives. Everyone has the right to equal access to public service in his country. The will of the people shall be the basis of the authority of government; this will shall be expressed in periodic and genuine elections which shall be by universal and equal suffrage and shall be held by secret vote or by equivalent free voting procedures. (22)Everyone, as a member of society, has the right to social security and is entitled to realization, through national effort and international co-operation and in accordance with the organization and resources of each State, of the economic, social and cultural rights indispensable for his dignity and the free development of his personality. (23)Everyone has the right to work, to free choice of employment, to just and favourable conditions of work and to protection against unemployment. Everyone, without any discrimination, has the right to equal pay for equal work. Everyone who works has the right to just and favourable remuneration ensuring for himself and his family an existence worthy of human dignity, and supplemented, if necessary, by other means of social protection. Everyone has the right to form and to join trade unions for the protection of his interests. (24)Everyone has the right to rest and leisure, including reasonable limitation of working hours and periodic holidays with pay. (25)Everyone has the right to a standard of living adequate for the health and well-being of himself and of his family, including food, clothing, housing and medical care and necessary social services, and the right to security in the event of unemployment, sickness, disability, widowhood, old age or other lack of livelihood in circumstances beyond his control. Motherhood and childhood are entitled to special care and assistance. All children, whether born in or out of wedlock, shall enjoy the same social protection. (26)Everyone has the right to education. Education shall be free, at least in the elementary and fundamental stages. Elementary education shall be compulsory. Technical and professional education shall be made generally available and higher education shall be equally accessible to all on the basis of merit. Education shall be directed to the full development of the human personality and to the strengthening of respect for human rights and fundamental freedoms. It shall promote understanding, tolerance and friendship among all nations, racial or religious groups, and shall further the activities of the United Nations for the maintenance of peace. Parents have a prior right to choose the kind of education that shall be given to their children. (27)Everyone has the right freely to participate in the cultural life of the community, to enjoy the arts and to share in scientific advancement and its benefits. Everyone has the right to the protection of the moral and material interests resulting from any scientific, literary or artistic production of which he is the author. (28)Everyone is entitled to a social and international order in which the rights and freedoms set forth in this Declaration can be fully realized. (29)Everyone has duties to the community in which alone the free and full development of his personality is possible. In the exercise of his rights and freedoms, everyone shall be subject only to such limitations as are determined by law solely for the purpose of securing due recognition and respect for the rights and freedoms of others and of meeting the just requirements of morality, public order and the general welfare in a democratic society. These rights and freedoms may in no case be exercised contrary to the purposes and principles of the United Nations. (30)Nothing in this Declaration may be interpreted as implying for any State, group or person any right to engage in any activity or to perform any act aimed at the destruction of any of the rights and freedoms set forth herein. Copyright (C) 1971 Ken Knowlton, Bell Telephone Laboratories, Murray Hill, N.J., USA
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/frag.glsl:
--------------------------------------------------------------------------------
1 | #ifdef GL_ES
2 | precision mediump float;
3 | precision mediump int;
4 | #endif
5 |
6 | uniform sampler2D textureSampler;
7 | uniform vec2 texcoordOffset;
8 |
9 | varying vec4 vertColor;
10 | varying vec4 vertTexcoord;
11 |
12 | #define KERNEL_SIZE 9
13 |
14 | // Gaussian kernel
15 | // 1 2 1
16 | // 2 4 2
17 | // 1 2 1
18 | float kernel[KERNEL_SIZE];
19 | float totalInf;
20 |
21 | vec2 offset[KERNEL_SIZE];
22 |
23 | void main(void) {
24 | int i = 0;
25 | vec4 sum = vec4(0.0);
26 |
27 | offset[0] = vec2(-texcoordOffset.s, -texcoordOffset.t);
28 | offset[1] = vec2(0.0, -texcoordOffset.t);
29 | offset[2] = vec2(texcoordOffset.s, -texcoordOffset.t);
30 |
31 | offset[3] = vec2(-texcoordOffset.s, 0.0);
32 | offset[4] = vec2(0.0, 0.0);
33 | offset[5] = vec2(texcoordOffset.s, 0.0);
34 |
35 | offset[6] = vec2(-texcoordOffset.s, texcoordOffset.t);
36 | offset[7] = vec2(0.0, texcoordOffset.t);
37 | offset[8] = vec2(texcoordOffset.s, texcoordOffset.t);
38 |
39 | /*
40 | kernel[0] = 1.0/16.0; kernel[1] = 2.0/16.0; kernel[2] = 1.0/16.0;
41 | kernel[3] = 2.0/16.0; kernel[4] = 4.0/16.0; kernel[5] = 2.0/16.0;
42 | kernel[6] = 1.0/16.0; kernel[7] = 2.0/16.0; kernel[8] = 1.0/16.0;
43 | */
44 | totalInf = 0.0;
45 | for(i = 0; i < KERNEL_SIZE; i++) {
46 | vec4 tmp = texture2D(textureSampler, vertTexcoord.st + offset[i]);
47 | if (i == 4){
48 | kernel[i] = 4.0;
49 | totalInf += 4.0;
50 | } else {
51 | //alpha is 1, so lets remove that from consideration
52 | kernel[i] = (length(tmp)-1.)*2.;
53 | totalInf += (length(tmp)-1.)*2.;
54 | }
55 | sum += tmp * kernel[i];
56 | }
57 | sum /= totalInf;
58 |
59 | //boost the contrast? or maybe make this a separate shader
60 | //I just ended up boosting the contrast in the source image
61 | //sum = acos(-(sum*2.-1.))/3.1415;
62 | //sum = max(log(max(sum, 0.1))+1., sum);
63 | //sum = max((-cos(sum*3.1415)+1.)/2., sum);
64 |
65 | gl_FragColor = vec4(sum.rgb, 1.0) * vertColor;
66 | }
67 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/girl_gaze_contrast1_small2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/matthewepler/ReCode_Project/d7d83ba39427d39f25951e587acbadfca68c83fe/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/data/girl_gaze_contrast1_small2.jpg
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n2_universal_declaration_of_human_rights/recode_v1n2_universal_declaration_of_human_rights.pde:
--------------------------------------------------------------------------------
1 | /*
2 | Part of the ReCode Project (http://recodeproject.com)
3 | Based on "Universal Declaration of Human Rights" by Kenneth Knowlton
4 | Originally published in "Computer Graphics and Art" vol1 no2, 1976
5 | Copyright (c) 2012 Quin Kennedy - OSI/MIT license (http://recodeproject/license).
6 | */
7 |
8 | //image from: http://www.metro.co.uk/news/841183-photos-around-the-world-in-80-days-competition-winners
9 |
10 | void setup(){
11 | //size(629, 821, P2D);//aspect ratio of piece in PDF
12 |
13 | if (use == 0){
14 | size(686, 820, P2D);//pretty close with Krungthep-10
15 | } else if (use == 1){
16 | size(646/*660*/, 818, P2D);//set for KufiStandardGK-10
17 | } else if (use == 2){
18 | size(686, 820, P2D);//pretty close with Krungthep-12
19 | } else if (use == 3){
20 | size(686, 819, P2D);//used with no font specified
21 | }
22 | noLoop();
23 | }
24 |
25 | PFont f;
26 | //3 works well, just the font is too clean
27 | //1 has a nice pixely font
28 | static final int use = 1;
29 |
30 | void draw(){
31 | PImage img = loadImage("girl_gaze_contrast1_small2.jpg");
32 | PGraphics i = createGraphics(width, height, P2D);
33 | i.beginDraw();
34 | i.background(0);
35 | float srcWidth = width/(((float)height)/img.height);
36 | i.blend(img, (int)((img.width - srcWidth)/2), 0, (int)srcWidth, img.height, 0, 0, width, height, DIFFERENCE);
37 | i.endDraw();
38 |
39 | PGraphics t = createGraphics(width, height, P2D);
40 | t.beginDraw();
41 | if (use == 0){
42 | f = loadFont("Krungthep-10.vlw");
43 | } else if (use == 1){
44 | f = loadFont("KufiStandardGK-10.vlw");//"Krungthep-10.vlw");
45 | } else if (use == 2){
46 | f = loadFont("Krungthep-12.vlw");
47 | } else if (use == 3){
48 | //don't load a font
49 | }
50 | if (f != null){
51 | t.textFont(f);
52 | }
53 | t.background(0);
54 | t.stroke(255);
55 | t.textAlign(CENTER);
56 | String s = join(loadStrings("Universal Declaration of Human Rights.txt"), " ");
57 | String small = s;
58 | int offset = 0;
59 | float px = width/2.;
60 | float py = 16;
61 | while (small.length() > 0){
62 | while (small.length() > 0 && !lineJustify(small, px, py, width-20, t)){
63 | int lastSpace = small.lastIndexOf(' ');
64 | if (lastSpace == -1){
65 | println("OH NO!");
66 | return;
67 | }
68 | small = small.substring(0, lastSpace);
69 | }
70 | py += 11;
71 | offset += small.length() + 1;
72 | if (offset >= s.length()){
73 | break;
74 | }
75 | small = s.substring(offset);
76 | }
77 | t.endDraw();
78 | PShader shade = loadShader("frag.glsl");
79 | i.loadPixels();
80 | t.loadPixels();
81 | loadPixels();
82 | for(int k = 0; k < pixels.length; k++){
83 | int ip = i.pixels[k];
84 | int tp = t.pixels[k];
85 | colorMode(RGB, 1);
86 | pixels[k] = color((red(ip)*3/4+.25)*(red(tp)),
87 | (green(ip)*3/4+.25)*(green(tp)),
88 | (blue(ip)*3/4+.25)*(blue(tp)));
89 | }
90 | updatePixels();
91 | filter(shade);
92 | filter(shade);
93 | //filter(shade);
94 | //filter(shade);
95 | //filter(THRESHOLD, .2);//too strong
96 | }
97 |
98 | //thanks to https://forum.processing.org/topic/writing-text-without-line-word-breaks
99 | boolean lineJustify(String s, float px, float py, int w, PGraphics g){
100 | float tw = g.textWidth(s);
101 | if (tw > w){
102 | return false;
103 | }
104 | if (tw == w){
105 | g.text(s, px, py);
106 | return true;
107 | }
108 | String[] tokens = split(s, " ");
109 | if (tokens.length <= 1){
110 | g.text(s, px, py);
111 | return true;
112 | }
113 | float tow = 0;
114 | for(String currS : tokens){
115 | tow += g.textWidth(currS);
116 | }
117 |
118 | float cx = px - w/2.;
119 | float gap = w - tow;
120 | float gutter = gap/(tokens.length-1.);
121 | for(int i = 0; i < tokens.length; i++){
122 | cx += g.textWidth(tokens[i])/2;
123 | g.text(tokens[i], cx, py);
124 | cx += g.textWidth(tokens[i])/2+gutter;
125 | }
126 | return true;
127 | }
128 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n3_Exploitation_Quantitative_et_Qualitative_do_Program/recode_v1n3_Exploitation_Quantitative_et_Qualitative_do_Program.pde:
--------------------------------------------------------------------------------
1 | PImage[] tiles = new PImage[7];
2 | static final int windowSize = 400;
3 | static final int tileSize = windowSize/15;
4 |
5 | void setup(){
6 | size(windowSize,windowSize, P2D);
7 | createTiles();
8 | noLoop();
9 | }
10 |
11 | void draw(){
12 | background(255);
13 | imageMode(CENTER);
14 | for(int i = 0; i < width; i+=tileSize){
15 | for(int j = 0; j < height; j+=tileSize){
16 | int tile = floor(random(tiles.length));
17 | //boolean bw = (random(2) >= 1);
18 | int rotation = floor(random(4));
19 | pushMatrix();
20 | translate(i,j);
21 | translate(tileSize/2, tileSize/2);
22 | rotate(PI*rotation/2);
23 | image(tiles[tile], 0, 0);
24 | popMatrix();
25 | }
26 | }
27 | }
28 |
29 | void createTiles(){
30 | int i = 0;
31 | PGraphics pg = createGraphics(tileSize, tileSize);
32 | pg.beginDraw();
33 | pg.background(0);
34 | pg.noStroke();
35 | pg.fill(255);
36 | pg.ellipse(0, 0, tileSize*2, tileSize*2);
37 | pg.endDraw();
38 | tiles[i++] = pg;
39 |
40 | PGraphics pg1 = createGraphics(tileSize, tileSize);
41 | pg1.beginDraw();
42 | pg1.background(255);
43 | pg1.noStroke();
44 | pg1.fill(0);
45 | pg1.ellipse(0, 0, tileSize*2, tileSize*2);
46 | pg1.endDraw();
47 | tiles[i++] = pg1;
48 |
49 | PGraphics pg2 = createGraphics(tileSize, tileSize);
50 | pg2.beginDraw();
51 | pg2.background(0);
52 | pg2.noStroke();
53 | pg2.fill(255);
54 | pg2.rect(0, 0, tileSize, tileSize/2);
55 | pg2.endDraw();
56 | tiles[i++] = pg2;
57 |
58 | PGraphics pg3 = createGraphics(tileSize, tileSize);
59 | pg3.beginDraw();
60 | pg3.background(255);
61 | pg3.noStroke();
62 | pg3.fill(0);
63 | pg3.rect(0, 0, tileSize, tileSize/2);
64 | pg3.endDraw();
65 | tiles[i++] = pg3;
66 |
67 | PGraphics pg4 = createGraphics(tileSize, tileSize);
68 | pg4.beginDraw();
69 | pg4.background(0);
70 | pg4.noStroke();
71 | pg4.fill(255);
72 | pg4.triangle(0, 0, tileSize, 0, 0, tileSize);
73 | pg4.endDraw();
74 | tiles[i++] = pg4;
75 |
76 | PGraphics pg5 = createGraphics(tileSize, tileSize);
77 | pg5.beginDraw();
78 | pg5.background(255);
79 | pg5.noStroke();
80 | pg5.fill(0);
81 | pg5.triangle(0, 0, tileSize, 0, 0, tileSize);
82 | pg5.endDraw();
83 | tiles[i++] = pg5;
84 |
85 | //might happen less often than others...
86 | PGraphics pg6 = createGraphics(tileSize, tileSize);
87 | pg6.beginDraw();
88 | pg6.background(0);
89 | pg6.endDraw();
90 | tiles[i++] = pg6;
91 | //PGraphics pg2 = createGraphics(width/15, width/15, P2D);
92 | }
93 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n3_untitled_1/recode_v1n3_untitled_1.pde:
--------------------------------------------------------------------------------
1 | int windowSize = 400;
2 | int pixelSize = 2;
3 | boolean showWarp[] = new boolean[windowSize/pixelSize+1];
4 |
5 | void setup(){
6 | size(windowSize, windowSize, P2D);
7 | setupWeft();
8 | noLoop();
9 | }
10 |
11 | void draw(){
12 | background(255);
13 | //int changeCounterReset = 5;
14 | //int changeCounter = changeCounterReset;
15 | float c = .5;
16 | float cInc = (1./(windowSize/pixelSize))*(3*10+1)/(7*10+1);//4/9;
17 | noStroke();
18 | for(int i = 0; i < width; i += pixelSize){
19 | for(int j = 0, k = 0; j < height; j += pixelSize, k++){
20 | fill(255*c);
21 | if (showWarp[k]){
22 | rect(i, j, pixelSize, pixelSize);
23 | }
24 | c += cInc;
25 | if(c > 1.0){
26 | c = 1.0;
27 | cInc = -cInc;
28 | } if (c < 0.0){
29 | c = 0.0;
30 | cInc = -cInc;
31 | }
32 | }
33 | }
34 | }
35 |
36 | void setupWeft(){
37 | for(int i = 0; i < showWarp.length; i++){
38 | showWarp[i] = random(1.) >= .5;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n3_untitled_2/recode_v1n3_untitled_2.pde:
--------------------------------------------------------------------------------
1 | PImage[] tiles = new PImage[2];
2 | static final int windowSize = 400;
3 | static final int tileSize = windowSize/5;
4 |
5 | void setup(){
6 | size(windowSize,windowSize, P2D);
7 | createTiles();
8 | noLoop();
9 | }
10 |
11 | void draw(){
12 | background(255);
13 | imageMode(CENTER);
14 | for(int i = 0; i < width; i+=tileSize){
15 | for(int j = 0; j < height; j+=tileSize){
16 | int tile = floor(random(tiles.length));
17 | //boolean bw = (random(2) >= 1);
18 | int rotation = floor(random(4));
19 | pushMatrix();
20 | translate(i,j);
21 | translate(tileSize/2, tileSize/2);
22 | rotate(PI*rotation/2);
23 | image(tiles[tile], 0, 0);
24 | popMatrix();
25 | }
26 | }
27 | }
28 |
29 | void createTiles(){
30 | int i = 0;
31 | PGraphics pg = createGraphics(tileSize, tileSize);
32 | pg.beginDraw();
33 | pg.background(0);
34 | pg.noStroke();
35 | pg.fill(255);
36 | pg.ellipse(0, 0, tileSize*2, tileSize*2);
37 | pg.endDraw();
38 | tiles[i++] = pg;
39 |
40 | PGraphics pg1 = createGraphics(tileSize, tileSize);
41 | pg1.beginDraw();
42 | pg1.background(255);
43 | pg1.noStroke();
44 | pg1.fill(0);
45 | pg1.ellipse(0, 0, tileSize*2, tileSize*2);
46 | pg1.endDraw();
47 | tiles[i++] = pg1;
48 | }
49 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n3_untitled_3/recode_v1n3_untitled_3.pde:
--------------------------------------------------------------------------------
1 | PVector[] points = {new PVector(0, 0), new PVector(1./3., 1./3.), new PVector(2./3., 2./3.),
2 | new PVector(4./3., 4./3.), new PVector(5./3., 5./3.), new PVector(2, 2)};
3 | static final int windowSize = 400;
4 | static final int tileSize = windowSize/6;
5 |
6 | void setup(){
7 | size(windowSize,windowSize, P2D);
8 | noLoop();
9 | }
10 |
11 | void draw(){
12 | background(255);
13 | imageMode(CENTER);
14 | for(int i = 0; i < width; i+=tileSize){
15 | for(int j = 0; j < height; j+=tileSize){
16 | PGraphics pg = createGraphics(tileSize, tileSize, P2D);
17 | pg.beginDraw();
18 | pg.background(255);
19 | pg.noStroke();
20 | pg.fill(0);
21 | pg.scale(tileSize);
22 | boolean black = (random(2.) >= 1.);
23 | for(int k = 1; k < points.length; k++){
24 | black = (random(1.) > .75 ? black : !black);
25 | if (!black){
26 | continue;
27 | }
28 | pg.quad(points[k-1].x, 0, points[k].x, 0, 0, points[k].y, 0, points[k-1].y);
29 | }
30 | pg.endDraw();
31 | pushMatrix();
32 | translate(i,j);
33 | translate(tileSize/2, tileSize/2);
34 | rotate(PI/2);
35 | image(pg, 0, 0);
36 | popMatrix();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v1n3_untitled_4/recode_v1n3_untitled_4.pde:
--------------------------------------------------------------------------------
1 | PImage[] tiles = new PImage[7];
2 | static final int windowSize = 400;
3 | static final int tileSize = windowSize/5;
4 |
5 | void setup(){
6 | size(windowSize,windowSize, P2D);
7 | createTiles();
8 | noLoop();
9 | }
10 |
11 | void draw(){
12 | background(255);
13 | imageMode(CENTER);
14 | for(int i = 0; i < width; i+=tileSize){
15 | for(int j = 0; j < height; j+=tileSize){
16 | int tile = floor(random(tiles.length));
17 | //boolean bw = (random(2) >= 1);
18 | int rotation = floor(random(4));
19 | pushMatrix();
20 | translate(i,j);
21 | translate(tileSize/2, tileSize/2);
22 | rotate(PI*rotation/2);
23 | image(tiles[tile], 0, 0);
24 | popMatrix();
25 | }
26 | }
27 | }
28 |
29 | void createTiles(){
30 | int i = 0;
31 | PGraphics pg = createGraphics(tileSize, tileSize);
32 | pg.beginDraw();
33 | pg.background(0);
34 | pg.noStroke();
35 | pg.fill(255);
36 | pg.ellipse(0, 0, tileSize*2, tileSize*2);
37 | pg.endDraw();
38 | tiles[i++] = pg;
39 |
40 | PGraphics pg1 = createGraphics(tileSize, tileSize);
41 | pg1.beginDraw();
42 | pg1.background(255);
43 | pg1.noStroke();
44 | pg1.fill(0);
45 | pg1.ellipse(0, 0, tileSize*2, tileSize*2);
46 | pg1.endDraw();
47 | tiles[i++] = pg1;
48 |
49 | PGraphics pg2 = createGraphics(tileSize, tileSize);
50 | pg2.beginDraw();
51 | pg2.background(0);
52 | pg2.noStroke();
53 | pg2.fill(255);
54 | pg2.rect(0, 0, tileSize, tileSize/2);
55 | pg2.endDraw();
56 | tiles[i++] = pg2;
57 |
58 | PGraphics pg3 = createGraphics(tileSize, tileSize);
59 | pg3.beginDraw();
60 | pg3.background(255);
61 | pg3.noStroke();
62 | pg3.fill(0);
63 | pg3.rect(0, 0, tileSize, tileSize/2);
64 | pg3.endDraw();
65 | tiles[i++] = pg3;
66 |
67 | PGraphics pg4 = createGraphics(tileSize, tileSize);
68 | pg4.beginDraw();
69 | pg4.background(0);
70 | pg4.noStroke();
71 | pg4.fill(255);
72 | pg4.triangle(0, 0, tileSize, 0, 0, tileSize);
73 | pg4.endDraw();
74 | tiles[i++] = pg4;
75 |
76 | PGraphics pg5 = createGraphics(tileSize, tileSize);
77 | pg5.beginDraw();
78 | pg5.background(255);
79 | pg5.noStroke();
80 | pg5.fill(0);
81 | pg5.triangle(0, 0, tileSize, 0, 0, tileSize);
82 | pg5.endDraw();
83 | tiles[i++] = pg5;
84 |
85 | //might happen less often than others...
86 | PGraphics pg6 = createGraphics(tileSize, tileSize);
87 | pg6.beginDraw();
88 | pg6.background(0);
89 | pg6.endDraw();
90 | tiles[i++] = pg6;
91 | //PGraphics pg2 = createGraphics(width/15, width/15, P2D);
92 | }
93 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v2n3_Segrid_by_John_Roy/recode_v2n3_Segrid_by_John_Roy.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol2 no3 pg 28
3 | // Segrid
4 | // by John Roy
5 | //
6 | // Quin Kennedy
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | //Since there are
11 | //8 sets of images plus a center empty image plus a 1/2 width of black border
12 | //this gives a canvas size of 8*2+1+.5*2 = 9*2 = 18 cells
13 | //each cell is 20 pixels wide (see comment in drawTile(...))
14 | static final float pixelSize = 1.5;
15 | static final int linesPerQuadrant = 5;
16 | //the tile size is the
17 | //(lines per quadrant + spaces per quadrant) * 2 quadrants per side * pixelSize
18 | static final int tileSize = linesPerQuadrant*2*2;
19 | static final float visualTileSize = tileSize*pixelSize;
20 | //subtract 1 because the center is not doubled
21 | //subtract another 1 because we only see half of the last tiles
22 | static final int numTiles = linesPerQuadrant*4-1-1;
23 | static final int windowSize = numTiles*tileSize;
24 | static final float visualWinSize = numTiles*visualTileSize;
25 |
26 | void setup(){
27 | size(ceil(visualWinSize), ceil(visualWinSize), P2D);
28 | noLoop();
29 | }
30 |
31 | void draw(){
32 | background(255);
33 | stroke(0);
34 | fill(0);
35 | strokeWeight(1);
36 | strokeCap(SQUARE);
37 | pushMatrix();
38 | scale(pixelSize);
39 | //translate(-tileSize/2., -tileSize/2.);
40 | //pick a random grid cell to be the focal point
41 | //for now we will restrict it to have at most one row/column of empty squares
42 | int focusX = numTiles/2;
43 | int focusY = numTiles/2;
44 | //for each grid cell...
45 | for(int i = 0, gi = 0; i <= numTiles; i++, gi += tileSize){
46 | for(int j = 0, gj = 0; j <= numTiles; j++, gj += tileSize){
47 | pushMatrix();
48 | translate(gi,gj);
49 | int num = min(max(abs(focusX-i), abs(focusY-j)), linesPerQuadrant*2);
50 | drawTile(num);
51 | popMatrix();
52 | }
53 | }
54 | popMatrix();
55 | }
56 |
57 | void drawTile(int iteration){
58 | //there are two versions of the tile, the first where 5 lines (with 5 spaces)
59 | //grow in,
60 | //and the second where each consecutive space gets filled in.
61 | if (iteration == 0){
62 | return;
63 | }
64 | pushMatrix();
65 | for(int i = 0; i < 4; i++){
66 | pushMatrix();
67 | translate(-linesPerQuadrant*2, -linesPerQuadrant*2);
68 | drawQuadrant(iteration);
69 | popMatrix();
70 | rotate(HALF_PI);
71 | }
72 | popMatrix();
73 | }
74 |
75 | void drawQuadrant(int iteration){
76 | if (iteration < linesPerQuadrant){
77 | pushMatrix();
78 | for(int i = 0; i < linesPerQuadrant; i++){
79 | line(0, .5, iteration*linesPerQuadrant*2./(linesPerQuadrant-1.), .5);
80 | translate(0, 2);
81 | }
82 | popMatrix();
83 | } else {
84 | drawQuadrant(linesPerQuadrant - 1);
85 | int lines = iteration - linesPerQuadrant;
86 | pushMatrix();
87 | translate(0, linesPerQuadrant*2-1);
88 | for(int i = 0; i <= lines; i++){
89 | line(0, .5, linesPerQuadrant*2, .5);
90 | translate(0, -2);
91 | }
92 | popMatrix();
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v3n2_From_the_Square_Series_by_Roger_Coqart/recode_v3n2_From_the_Square_Series_by_Roger_Coqart.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 30
3 | // From the Square Series
4 | // by Roger Coqart
5 | //
6 | // Quin Kennedy
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | LineData[] tileData;
11 | //number selection inspired by version in PDF, not screenshot on website.
12 | static final int numTiles = 17;
13 | static final float gutterRelativeSize = 0;
14 | static final int windowSize = 550;
15 | static final float aspectRatio = 2./3.;
16 | //we need space for each tile,
17 | //space for each gutter to the left of each tile,
18 | //and space for the final gutter (to the right of the final tile)
19 | static final int tileSize = floor(windowSize/(numTiles*(1+gutterRelativeSize)+gutterRelativeSize));
20 | static final int gutterSize = floor(tileSize*gutterRelativeSize);
21 |
22 | void setup(){
23 | int actualWinSize = (tileSize+gutterSize)*numTiles+gutterSize;
24 | size(actualWinSize, (int)(actualWinSize*aspectRatio));
25 | createTiles();
26 | noLoop();
27 | }
28 |
29 | void draw(){
30 | smooth(8);
31 | background(0);
32 | stroke(255);
33 | strokeWeight(2.5);
34 | strokeJoin(ROUND);
35 | strokeCap(ROUND);
36 | noFill();
37 | //pick a random grid cell to be the focal point
38 | //for now we will restrict it to have at most one row/column of empty squares
39 | int focusX = floor(random(numTiles-9, 9));
40 | int focusY = floor(random(numTiles-9, 9));
41 | //for each grid cell...
42 | for(float gi = 0; gi < width; gi += gutterSize+tileSize){
43 | for(float gj = 0; gj < height; gj += gutterSize+tileSize){
44 | pushMatrix();
45 | translate(gi,gj);
46 | //rect(0, 0, tileSize, tileSize);
47 | shuffleTiles();
48 | int num = floor(random(3, tileData.length));//max((tileData.length - max(abs(focusX-i), abs(focusY-j))), 0);
49 | for(int k = 0; k < num; k++){
50 | LineData td = tileData[k];
51 | line(td.sx, td.sy, td.ex, td.ey);
52 | }
53 | popMatrix();
54 | }
55 | }
56 | }
57 |
58 | //uses the Knuth Shuffle
59 | void shuffleTiles(){
60 | for(int i = 0; i < tileData.length-1; i++){
61 | int swapWith = floor(random(i, tileData.length));
62 |
63 | LineData temp = tileData[i];
64 | tileData[i] = tileData[swapWith];
65 | tileData[swapWith] = temp;
66 | }
67 | }
68 |
69 | void createTiles(){
70 | //the two lines of the +
71 | //and the four lines of the square
72 | //and the four lines of the x -- reduced to 2 after looking at http://recodeproject.com/translation/benjamin-fox-direct-from-the-square-series-roger-coqart
73 | int numTileTypes = 2+4+2;
74 | int i = 0;
75 | tileData = new LineData[numTileTypes];
76 | //two lines of the +
77 | tileData[i++] = new LineData(tileSize/2, 0, tileSize/2, tileSize);
78 | tileData[i++] = new LineData(0, tileSize/2, tileSize, tileSize/2);
79 |
80 | //four lines of the square
81 | tileData[i++] = new LineData(tileSize/2, 0, 0, tileSize/2);
82 | tileData[i++] = new LineData(0, tileSize/2, tileSize/2, tileSize);
83 | tileData[i++] = new LineData(tileSize/2, tileSize, tileSize, tileSize/2);
84 | tileData[i++] = new LineData(tileSize, tileSize/2, tileSize/2, 0);
85 | //two lines of the x
86 | tileData[i++] = new LineData(0, 0, tileSize, tileSize);
87 | tileData[i++] = new LineData(tileSize, 0, 0, tileSize);
88 | /*tileData[i++] = new LineData(0, 0, tileSize/2, tileSize/2);
89 | tileData[i++] = new LineData(tileSize/2, tileSize/2, tileSize, tileSize);
90 | tileData[i++] = new LineData(tileSize, 0, tileSize/2, tileSize/2);
91 | tileData[i++] = new LineData(tileSize/2, tileSize/2, 0, tileSize);*/
92 | }
93 |
94 | class LineData{
95 | public float sx,sy,ex,ey;
96 | public LineData(float _sx, float _sy, float _ex, float _ey){
97 | sx = _sx;
98 | sy = _sy;
99 | ex = _ex;
100 | ey = _ey;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v3n2_unimaginable_images_Vera_Molnar/recode_v3n2_unimaginable_images_Vera_Molnar.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 31
3 | // Unimaginable Images (from the "196 Trapeziums Series")
4 | // by Vera Molnar
5 | //
6 | //
7 | // Quin Kennedy
8 | // 2012
9 | // Creative Commons license CC BY-SA 3.0
10 |
11 | static final int numTiles = 14;
12 | static final float gutterRelativeSize = .5;
13 | static final int windowSize = 400;
14 | //we need space for each tile,
15 | //space for each gutter above each tile,
16 | //and space for the final gutter (below of the bottom row)
17 | static final int tileSize = floor(windowSize/(numTiles*(1+gutterRelativeSize)+gutterRelativeSize));
18 | static final int gutterSize = floor(tileSize*gutterRelativeSize);
19 |
20 | void setup(){
21 | int actualWinSize = (tileSize+gutterSize)*numTiles+gutterSize;
22 | size(actualWinSize, actualWinSize);
23 | noLoop();
24 | }
25 |
26 | void draw(){
27 | background(255);
28 | stroke(0);
29 | //strokeWeight(2);
30 | strokeJoin(ROUND);
31 | noFill();
32 | //for each grid cell...
33 | for(int i = 0, gi = gutterSize; i < numTiles; i++, gi += gutterSize+tileSize){
34 | for(int j = 0, gj = gutterSize; j < numTiles; j++, gj += gutterSize+tileSize){
35 | drawTrapezium(gi+tileSize/2, gj+tileSize/2);
36 | }
37 | }
38 | }
39 |
40 | void drawTrapezium(float xCenter, float yCenter){
41 | float topScale = random(-2, 2);
42 | float bottomScale = random(-2, 2);
43 | float halfTile = tileSize/2.;
44 | quad(xCenter - tileSize/2 + random(-tileSize, tileSize), yCenter - halfTile,
45 | xCenter + tileSize/2 + random(-tileSize, tileSize), yCenter - halfTile,
46 | xCenter + tileSize/2 + random(-tileSize, tileSize), yCenter + halfTile,
47 | xCenter - tileSize/2 + random(-tileSize, tileSize), yCenter + halfTile);
48 | }
49 |
--------------------------------------------------------------------------------
/quin_kennedy/recode_v3n2_untitled_Vera_Molnar/recode_v3n2_untitled_Vera_Molnar.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no2 pg 31
3 | // Untitled (from the "196 Trapeziums Series")
4 | // by Vera Molnar
5 | //
6 | //
7 | // Quin Kennedy
8 | // 2012
9 | // Creative Commons license CC BY-SA 3.0
10 |
11 | static final int numTiles = 14;
12 | static final float gutterRelativeSize = 0;
13 | static final int windowSize = 400;
14 | //we need space for each tile,
15 | //space for each gutter to the left of each tile,
16 | //and space for the final gutter (to the right of the final tile)
17 | static final int tileSize = floor(windowSize/(numTiles*(1+gutterRelativeSize)+gutterRelativeSize));
18 | static final int gutterSize = floor(tileSize*gutterRelativeSize);
19 |
20 | void setup(){
21 | int actualWinSize = (tileSize+gutterSize)*numTiles+gutterSize;
22 | size(actualWinSize, actualWinSize);
23 | noLoop();
24 | }
25 |
26 | void draw(){
27 | background(255);
28 | stroke(0);
29 | //strokeWeight(2);
30 | strokeJoin(ROUND);
31 | noFill();
32 | //for each grid cell...
33 | for(int i = 0, gi = gutterSize; i < numTiles; i++, gi += gutterSize+tileSize){
34 | for(int j = 0, gj = gutterSize; j < numTiles; j++, gj += gutterSize+tileSize){
35 | drawTrapezium(random(tileSize, width-tileSize-tileSize), random(tileSize/2., height-tileSize));
36 | }
37 | }
38 | }
39 |
40 | void drawTrapezium(float xCenter, float yCenter){
41 | float topScale = random(-2, 2);
42 | float bottomScale = random(-2, 2);
43 | float halfTile = tileSize/2.;
44 | quad(xCenter - tileSize/2 + random(-tileSize, tileSize), yCenter - halfTile,
45 | xCenter + tileSize/2 + random(-tileSize, tileSize), yCenter - halfTile,
46 | xCenter + tileSize/2 + random(-tileSize, tileSize), yCenter + halfTile,
47 | xCenter - tileSize/2 + random(-tileSize, tileSize), yCenter + halfTile);
48 | }
49 |
--------------------------------------------------------------------------------
/sermad_buni/boxes/boxes.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol2 no3 pg 10
3 | // by William Kolomyjec
4 | // "Boxes"
5 | //
6 | // Sermad Buni
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | void setup() {
11 |
12 | int canvaswidth = 17;
13 | int canvasheight = 10;
14 |
15 | int square_size = 40;
16 |
17 | float randomness = 0.03;
18 |
19 | float iw, jh;
20 |
21 | smooth(8);
22 |
23 | // set the size of the canvas
24 | size( (canvaswidth+2)*square_size, (canvasheight+2)*square_size, P2D );
25 |
26 | // set the background of the canvas
27 |
28 | background(#ffffff);
29 |
30 | // draw the squares
31 |
32 | // by default squares are drawn with a filled colour
33 | // so we need to turn this off
34 |
35 | noFill();
36 |
37 | // we need to make a loop in a loop
38 |
39 | for(int i=0; i < canvaswidth; i++) {
40 |
41 | for(int j=0; j < canvasheight; j++) {
42 |
43 | pushMatrix();
44 |
45 | // move the origin to the pivot point
46 | translate((square_size*i), (square_size*j));
47 |
48 | // simple algo to increase rotation towards
49 | // the middle of the grid
50 | // check for odd or even canvas size to slightly alter the algo
51 |
52 | if(canvasheight % 2 == 0) {
53 | iw = canvaswidth/2 - Math.abs(i - canvaswidth/2);
54 | } else {
55 | iw = canvaswidth/2 - 0.5 - Math.abs(i - canvaswidth/2 - 0.5);
56 | }
57 |
58 | if(canvasheight % 2 == 0) {
59 | jh = canvasheight/2 - 0.5 - Math.abs(j - canvasheight/2 + 0.5);
60 | } else {
61 | jh = canvasheight/2 - Math.abs(j - canvasheight/2);
62 | }
63 |
64 | // check if we are not drawing the outer edges
65 | if( jh != 0 || iw != 0) {
66 |
67 | // rotate the square
68 | rotate( radians(iw * iw * jh * jh * random(-randomness,randomness)) );
69 |
70 | }
71 |
72 | // draw the square at the origin
73 | rect(square_size, square_size, square_size, square_size);
74 |
75 | popMatrix();
76 |
77 | }
78 |
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/sermad_buni/traveling_through_the_square_series/square.pde:
--------------------------------------------------------------------------------
1 | class Square {
2 |
3 | int i, j, type;
4 |
5 | int tri_padding = 3;
6 | int tri_length = square_size-tri_padding;
7 |
8 | boolean top_open;
9 | boolean right_open;
10 | boolean bottom_open;
11 | boolean left_open;
12 |
13 | Square (int i_, int j_) {
14 |
15 | i = i_;
16 | j = j_;
17 |
18 | //type = 0;
19 | //type = 1;
20 | // set the triange type - big or small
21 | type = int (random(2));
22 |
23 | // assign one side randonly to be blank
24 | // but match up two blank sides
25 | setRandomSide();
26 |
27 | }
28 |
29 | boolean checkRandomSide() {
30 |
31 | if(top_open || bottom_open || left_open || right_open) {
32 | return true;
33 | } else {
34 | return false;
35 | }
36 |
37 | }
38 |
39 | void setRandomSide() {
40 |
41 | /// check if we are not on the first column
42 | if(i > 0) {
43 |
44 | // check if the square to the left has a space open to the right
45 | // if so then this square needs to open to the left
46 |
47 | if(squares[i-1][j].right_open) {
48 |
49 | left_open = true;
50 |
51 | }
52 |
53 | }
54 |
55 | if(j > 0) { // check if we are on the top row
56 |
57 | // check if the square to the above has a space open to the bottom
58 | // if so then this square needs to open to the top
59 | if(squares[i][j-1].bottom_open) {
60 |
61 | top_open = true;
62 |
63 | }
64 |
65 | }
66 |
67 | // check if we are not on the bottom row
68 | if(j < canvasheight-1 && !checkRandomSide() ) {
69 | bottom_open = generateRandom();
70 | }
71 |
72 | // check if we are not on far right column
73 | if( i < canvaswidth-1 && !checkRandomSide() ) {
74 | right_open = generateRandom();
75 | }
76 |
77 | }
78 |
79 | boolean generateRandom() {
80 |
81 | int R = int (random(1));
82 |
83 | if(R == 0) {
84 | return true;
85 | } else {
86 | return true;
87 | }
88 |
89 | }
90 |
91 | void display() {
92 |
93 | switch(type) {
94 | case 0:
95 |
96 | // big triangles
97 |
98 | pushMatrix();
99 |
100 | translate((square_size*i) + square_size, (square_size*j) + square_size);
101 |
102 | if(int (random(2)) == 0) {
103 |
104 | if(left_open) {
105 |
106 |
107 |
108 | beginShape();
109 |
110 | vertex(0, tri_padding);
111 | vertex(tri_length - tri_padding, tri_padding);
112 | vertex(0, tri_length - 0);
113 |
114 | endShape();
115 |
116 | } else if(top_open) {
117 |
118 | // fixed
119 | beginShape();
120 |
121 |
122 |
123 | vertex(tri_padding, 0);
124 | vertex(tri_padding, tri_length - tri_padding);
125 | vertex(tri_length-0, 0);
126 |
127 | endShape();
128 |
129 | } else if (right_open) {
130 |
131 | // no need
132 | beginShape();
133 |
134 | vertex(tri_padding, tri_padding);
135 | vertex(tri_length-tri_padding, tri_padding);
136 | vertex(tri_padding, tri_length-tri_padding);
137 |
138 |
139 | endShape(CLOSE);
140 |
141 | } else {
142 |
143 |
144 |
145 | beginShape();
146 |
147 | vertex(tri_padding, tri_padding);
148 | vertex(tri_length-tri_padding, tri_padding);
149 | vertex(tri_padding, tri_length-tri_padding);
150 |
151 | endShape(CLOSE);
152 | }
153 |
154 |
155 |
156 | if(bottom_open) {
157 |
158 | // fixed
159 |
160 | beginShape();
161 |
162 | vertex(tri_padding+0, tri_length+tri_padding);
163 |
164 | vertex(tri_length, tri_padding+tri_padding);
165 | vertex(tri_length, tri_length+tri_padding);
166 |
167 | endShape();
168 |
169 | } else if(right_open) {
170 |
171 | beginShape();
172 |
173 | //stroke(255,0,255);
174 |
175 | vertex(tri_length + tri_padding, tri_padding + 0);
176 | vertex(tri_padding + tri_padding, tri_length);
177 | vertex(tri_length + tri_padding, tri_length);
178 |
179 |
180 | endShape();
181 |
182 | }else {
183 |
184 | beginShape();
185 |
186 | vertex(tri_length, tri_padding+tri_padding);
187 | vertex(tri_padding+tri_padding, tri_length);
188 | vertex(tri_length, tri_length);
189 |
190 | endShape(CLOSE);
191 | }
192 |
193 | } else {
194 |
195 | //
196 |
197 | if(left_open) {
198 |
199 | // fixed
200 |
201 | beginShape();
202 |
203 | vertex(0, tri_padding+0);
204 | vertex(tri_length-tri_padding, tri_length);
205 | vertex(0, tri_length);
206 |
207 | endShape();
208 |
209 | } else if(bottom_open) {
210 |
211 | // fixed
212 |
213 | beginShape();
214 |
215 | vertex(tri_padding, tri_length+tri_padding);
216 |
217 | vertex(tri_padding, tri_padding+tri_padding);
218 | vertex(tri_length, tri_length+tri_padding);
219 |
220 | endShape();
221 |
222 | } else if(right_open) {
223 |
224 | // no need
225 |
226 | beginShape();
227 |
228 |
229 | vertex(tri_padding, tri_length);
230 |
231 | vertex(tri_padding, tri_padding+tri_padding);
232 | vertex(tri_length-tri_padding, tri_length);
233 |
234 | endShape(CLOSE);
235 |
236 | } else {
237 |
238 | beginShape();
239 |
240 | vertex(tri_padding, tri_length);
241 |
242 | vertex(tri_padding, tri_padding+tri_padding);
243 | vertex(tri_length-tri_padding, tri_length);
244 |
245 | endShape(CLOSE);
246 | }
247 |
248 |
249 | //
250 |
251 |
252 |
253 | if(top_open) {
254 |
255 | beginShape();
256 |
257 | // fixed
258 |
259 | vertex(tri_padding, 0);
260 | vertex(tri_length, tri_length-tri_padding);
261 | vertex(tri_length, 0);
262 |
263 | endShape();
264 |
265 | } else if (right_open) {
266 |
267 | // fixed
268 |
269 | beginShape();
270 |
271 | vertex(tri_length + tri_padding, tri_length - 0);
272 | vertex(tri_padding+tri_padding, tri_padding);
273 | vertex(tri_length + tri_padding, tri_padding);
274 |
275 | endShape();
276 |
277 | } else {
278 |
279 | beginShape();
280 |
281 | vertex(tri_length, tri_length-tri_padding);
282 | vertex(tri_padding+tri_padding, tri_padding);
283 | vertex(tri_length, tri_padding);
284 |
285 | endShape(CLOSE);
286 |
287 |
288 | }
289 |
290 | }
291 |
292 | popMatrix();
293 |
294 | break;
295 | case 1:
296 |
297 | // little triangles
298 |
299 | pushMatrix();
300 | translate((square_size*i) + square_size, (square_size*j) + square_size);
301 |
302 | // top
303 | beginShape();
304 |
305 | if(top_open) {
306 |
307 | vertex(tri_padding, 0);
308 | vertex(square_size/2, (square_size/2) - tri_padding);
309 | vertex(tri_length, 0);
310 |
311 | endShape();
312 |
313 | } else {
314 |
315 | vertex(tri_padding+tri_padding, tri_padding);
316 | vertex(square_size/2, (square_size/2) - tri_padding);
317 | vertex(tri_length-tri_padding, tri_padding);
318 |
319 | endShape(CLOSE);
320 | }
321 |
322 | // right
323 | beginShape();
324 |
325 | if(right_open) {
326 |
327 | vertex(tri_length + tri_padding, tri_padding);
328 | vertex( (square_size/2) + tri_padding, square_size/2);
329 | vertex(tri_length + tri_padding, tri_length );
330 |
331 | endShape();
332 |
333 | } else {
334 |
335 | vertex(tri_length, tri_padding+tri_padding);
336 | vertex( (square_size/2) + tri_padding, square_size/2);
337 | vertex(tri_length, tri_length - tri_padding);
338 |
339 | endShape(CLOSE);
340 | }
341 |
342 | // bottom
343 |
344 | beginShape();
345 |
346 | if(bottom_open) {
347 |
348 | vertex(tri_padding, tri_length + tri_padding );
349 |
350 | vertex(square_size/2, (square_size/2) + tri_padding );
351 | vertex(tri_length, tri_length + tri_padding );
352 |
353 | endShape();
354 |
355 | } else {
356 |
357 | vertex(tri_padding+tri_padding, tri_length );
358 |
359 | vertex(square_size/2, (square_size/2) + tri_padding );
360 | vertex(tri_length-tri_padding, tri_length );
361 |
362 | endShape(CLOSE);
363 | }
364 |
365 | // left
366 |
367 |
368 | if(left_open) {
369 |
370 | beginShape();
371 |
372 | vertex(0, tri_padding );
373 | vertex( (square_size/2) - tri_padding, square_size/2);
374 | vertex(0, tri_length );
375 |
376 | endShape();
377 | } else {
378 |
379 | beginShape();
380 |
381 | vertex(tri_padding, tri_padding+tri_padding);
382 | vertex( (square_size/2) - tri_padding, square_size/2);
383 | vertex(tri_padding, tri_length - tri_padding);
384 |
385 | endShape(CLOSE);
386 | }
387 |
388 |
389 | popMatrix();
390 |
391 | break;
392 | }
393 |
394 | }
395 |
396 | }
397 |
--------------------------------------------------------------------------------
/sermad_buni/traveling_through_the_square_series/traveling_through_the_square_series.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol1 no3 pg 25
3 | // by Roger Coqart
4 | // "Traveling through the square series"
5 | //
6 | // Sermad Buni
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | // globals
11 | int square_size = 40;
12 | int canvaswidth = 16;
13 | int canvasheight = 9;
14 |
15 | Square[][] squares = new Square[canvaswidth][canvasheight];
16 |
17 | void setup() {
18 |
19 | strokeWeight(1);
20 |
21 | smooth(8);
22 |
23 | // set the size of the canvas
24 | size( (canvaswidth + 2) * square_size, (canvasheight + 2) * square_size, P2D );
25 |
26 | // set the background of the canvas
27 | background(#ffffff);
28 |
29 | // by default squares are drawn with a filled colour
30 | // so we need to turn this off
31 | noFill();
32 |
33 | // we need to make a loop in a loop
34 |
35 | for(int i=0; i < canvaswidth; i++) {
36 |
37 | for(int j=0; j < canvasheight; j++) {
38 |
39 | squares[i][j] = new Square(i, j);
40 |
41 | squares[i][j].display();
42 |
43 | }
44 |
45 | }
46 |
47 | // finished!
48 | // save("traveling_through_square_series.jpg");
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/steve_berrick/HexVariations/HexVariations.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no4 Back Cover
3 | // by William Kolomyjec
4 | // "Hex Variations"
5 | //
6 | // Steve Berrick
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | int _width = 600;
11 | int _height = 900;
12 | int _size = 20; // hexagon radius
13 |
14 | void setup() {
15 |
16 | size(_width, _height);
17 | noLoop();
18 |
19 | background(255);
20 | noFill();
21 | stroke(0);
22 | strokeWeight(2);
23 |
24 | }
25 |
26 | void draw() {
27 |
28 | // clear background
29 | background(255);
30 |
31 | // line length (hypotenuse)
32 | float h = sin(THIRD_PI) * _size;
33 |
34 | for (int i = 0; i <= _width / (_size * 3); i++) {
35 | for (int j = 0; j <= (_height / h) + 1; j++) {
36 |
37 | // reference points (centre of each hexagon)
38 | float x = i * _size * 3 + (_size / 2);
39 | float y = j * h;
40 | // offset each odd row
41 | if (j % 2 > 0) {
42 | x += _size * 1.5;
43 | }
44 |
45 | pushMatrix();
46 |
47 | translate(x, y);
48 |
49 | // random hexagon 'rotation' (0, 120, 240 degrees)
50 | rotate(int(random(0, 3)) * THIRD_PI);
51 |
52 | // draw line
53 | line(0, -h, 0, h);
54 |
55 | // draw arcs
56 | arc(-_size, 0, _size, _size, -THIRD_PI, THIRD_PI);
57 | arc( _size, 0, _size, _size, THIRD_PI * 2, THIRD_PI * 4);
58 |
59 | popMatrix();
60 |
61 | }
62 | }
63 |
64 | }
65 |
66 | void mousePressed() {
67 |
68 | redraw();
69 |
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/steve_berrick/HexVariationsRegular/HexVariationsRegular.pde:
--------------------------------------------------------------------------------
1 | // This sketch is part of the ReCode Project - http://recodeproject.com
2 | // From Computer Graphics and Art vol3 no4 Back Cover
3 | // by William Kolomyjec
4 | // "Hex Variations"
5 | //
6 | // Steve Berrick
7 | // 2012
8 | // Creative Commons license CC BY-SA 3.0
9 |
10 | int _width = 600;
11 | int _height = 900;
12 | int _size = 20; // hexagon radius
13 |
14 | int mod = 2;
15 |
16 | void setup() {
17 |
18 | size(_width, _height);
19 | noLoop();
20 |
21 | background(255);
22 | noFill();
23 | stroke(0);
24 | strokeWeight(2);
25 |
26 | }
27 |
28 | void draw() {
29 |
30 | // clear background
31 | background(255);
32 |
33 | // line length (hypotenuse)
34 | float h = sin(THIRD_PI) * _size;
35 | int r = 0;
36 |
37 | for (int i = 0; i <= _width / (_size * 3); i++) {
38 | for (int j = 0; j <= (_height / h) + 1; j++) {
39 |
40 | // reference points (centre of each hexagon)
41 | float x = i * _size * 3 + (_size / 2);
42 | float y = j * h;
43 | // offset each odd row
44 | if (j % 2 > 0) {
45 | x += _size * 1.5;
46 | }
47 | r++;
48 |
49 | pushMatrix();
50 |
51 | translate(x, y);
52 |
53 | // random hexagon 'rotation' (0, 120, 240 degrees)
54 | rotate(r % mod * THIRD_PI);
55 |
56 | // draw line
57 | line(0, -h, 0, h);
58 |
59 | // draw arcs
60 | arc(-_size, 0, _size, _size, -THIRD_PI, THIRD_PI);
61 | arc( _size, 0, _size, _size, THIRD_PI * 2, THIRD_PI * 4);
62 |
63 | popMatrix();
64 |
65 | }
66 | }
67 |
68 | }
69 |
70 | void mousePressed() {
71 |
72 | redraw();
73 |
74 | }
75 |
76 | void mouseMoved() {
77 |
78 | mod = (mouseX % width / (_size * 3)) + 1;
79 | redraw();
80 |
81 | }
82 |
83 | void keyReleased() {
84 |
85 | if (key == 's' || key == 'S') {
86 | Date d = new Date();
87 | saveFrame(d.getTime()+".jpg");
88 | }
89 |
90 | }
91 |
92 |
--------------------------------------------------------------------------------