Source code for program that produces imagery based on a mixture of image data and real-time, global, seismic data for Nude Studies in Aleatoric Environments.
Lines containing comments are highlighted in yellow. Feel free to leave your own comments or questions. I will watch these pages and respond.
Pall Thayer| line no. 1 (1 comments) | import processing.net.*; |
| line no. 2 (0 comments) | /* |
| line no. 3 (0 comments) | ˆ© Copyright 2008, Pall Thayer |
| line no. 4 (0 comments) | This file is part of "Nude Studies in Aleatoric Environments". |
| line no. 5 (0 comments) | 'Nude Studies in Aleatoric Environments' is art: you can redistribute |
| line no. 6 (0 comments) | it and/or modify it under the terms of the GNU General Public License |
| line no. 7 (0 comments) | as published by the Free Software Foundation, either version 3 of the |
| line no. 8 (0 comments) | License, or (at your option) any later version. |
| line no. 9 (0 comments) | 'Nude Studies in Aleatoric Environments' is distributed in the |
| line no. 10 (0 comments) | hope that it will be useful, but WITHOUT ANY WARRANTY; without |
| line no. 11 (0 comments) | even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| line no. 12 (0 comments) | PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| line no. 13 (0 comments) | You should have received a copy of the GNU General Public License |
| line no. 14 (0 comments) | along with "Nude Studies in Aleatoric Environments". If not, |
| line no. 15 (0 comments) | see <http://www.gnu.org/licenses/>. |
| line no. 16 (0 comments) | */ |
| line no. 17 (0 comments) | Client myClient; |
| line no. 18 (0 comments) | String dataIn; |
| line no. 19 (1 comments) | int[] line_weight = {1, 1, 1, 1}; |
| line no. 20 (1 comments) | int img_count = 0; |
| line no. 21 (0 comments) | background(255); |
| line no. 22 (1 comments) | myClient = new Client(this, "host.machine", 6789); |
| line no. 23 (0 comments) | smooth(); |
| line no. 24 (0 comments) | noFill(); |
| line no. 25 (0 comments) | frameRate(25); |
| line no. 26 (0 comments) | stroke(0, 0, 0); |
| line no. 27 (0 comments) | try{ |
| line no. 28 (0 comments) | if (myClient.available() > 0) { |
| line no. 29 (1 comments) | dataIn = myClient.readString(); |
| line no. 30 (1 comments) | String items[] = split(dataIn, ' '); |
| line no. 31 (0 comments) | for(int i = 1;i <= 4;i++){ |
| line no. 32 (1 comments) | draw_lines(items, i); |
| line no. 33 (0 comments) | } |
| line no. 34 (1 comments) | if(items[0].matches("newimage")){ |
| line no. 35 (0 comments) | img_count++; |
| line no. 36 (1 comments) | if(img_count == 5){ |
| line no. 37 (0 comments) | noStroke(); |
| line no. 38 (0 comments) | fill(#FFFFFF); |
| line no. 39 (0 comments) | rect(0, 0, 800, 600); |
| line no. 40 (1 comments) | img_count = 0; |
| line no. 41 (0 comments) | noFill(); |
| line no. 42 (0 comments) | } |
| line no. 43 (0 comments) | } |
| line no. 44 (0 comments) | } |
| line no. 45 (0 comments) | } |
| line no. 46 (0 comments) | catch(Exception e){ |
| line no. 47 (0 comments) | } |
| line no. 48 (0 comments) | } |
| line no. 49 (1 comments) | void draw_lines(String[] line_data, int img_num){ |
| line no. 50 (1 comments) | int[] x_offset = { |
| line no. 51 (0 comments) | 0, 400, 0, 400 }; |
| line no. 52 (1 comments) | int[] y_offset = { |
| line no. 53 (0 comments) | 0, 0, 300, 300 }; |
| line no. 54 (0 comments) | try{ |
| line no. 55 (0 comments) | if(line_data.length > 5){ |
| line no. 56 (1 comments) | int thisCol = unhex(line_data[1]); |
| line no. 57 (0 comments) | stroke(thisCol); |
| line no. 58 (0 comments) | } |
| line no. 59 (0 comments) | if(line_data[0].matches("seisdat")){ |
| line no. 60 (1 comments) | String seis_data[] = split(line_data[1], ':'); |
| line no. 61 (0 comments) | line_weight[int(seis_data[0])-1] = int(seis_data[1]); |
| line no. 62 (0 comments) | } |
| line no. 63 (0 comments) | strokeWeight(line_weight[img_num-1]); |
| line no. 64 (1 comments) | if(line_data[0].matches("line")){ |
| line no. 65 (0 comments) | line(int(line_data[2])+x_offset[img_num-1], int(line_data[3])+y_offset[img_num-1], int(line_data[4])+x_offset[img_num-1], int(line_data[5])+y_offset[img_num-1]); |
| line no. 66 (0 comments) | } |
| line no. 67 (1 comments) | if(line_data[0].matches("curve")){ |
| line no. 68 (0 comments) | bezier(int(line_data[2])+x_offset[img_num-1], int(line_data[3])+y_offset[img_num-1], int(line_data[4])+x_offset[img_num-1], int(line_data[5])+y_offset[img_num-1], int(line_data[6])+x_offset[img_num-1], int(line_data[7])+y_offset[img_num-1], int(line_data[8])+x_offset[img_num-1], int(line_data[9])+y_offset[img_num-1]); |
| line no. 69 (0 comments) | } |
| line no. 70 (0 comments) | } |
| line no. 71 (0 comments) | catch(Exception e){ |
| line no. 72 (0 comments) | } |
| line no. 73 (0 comments) | } |