import damkjer.ocd.*; // import OCD library Camera camera1, camera2, camera3; PFont f1, f2; boolean isPdown, isOdown; boolean toggleLines = true; DataCircle[] circles; // create a variable named 'circles' that will store an array of DataCircle objects DataCircle newDC; GraphLine[] lines; int xMax, yMax, zMax = 0; int xMin, yMin, zMin = 1000000; SuperText[] labels, ticks; void setup() { importData(); // imports the data from DarData.csv file frameRate(20); // sets the frame rate to 20 frames per second size(870,500, P3D); // set the window size and use P3D for rendering sphereDetail(8); // sets the detail resolution for the data points noStroke(); // draw all shapes without a border setupCameras(); // defines the cameras and their positions setupGraphLines(); // defines the visible graph lines setupText(); // defines the text in the graph } void draw() { background(227,230,220); //lights(); if (isPdown) camera2.feed(); else if (isOdown) camera3.feed(); else camera1.feed(); if (toggleLines){ for(int i=0; i abs(xMax)) xMax = newDC.x; if (abs(newDC.x) < abs(xMin)) xMin = newDC.x; if (abs(newDC.y) > abs(yMax)) yMax = newDC.y; if (abs(newDC.y) < abs(yMin)) yMin = newDC.y; if (abs(newDC.z) > abs(zMax)) zMax = newDC.z; if (abs(newDC.z) < abs(zMin)) zMin = newDC.z; circles = (DataCircle[]) append(circles, newDC); } } void setupCameras() { int xMid = int((xMax+xMin)/2); int yMid = int((yMax+yMin)/2); int zMid = int((zMax+zMin)/2); camera1 = new Camera(this, xMid, 730000, 2035, xMid, yMid, 2035); camera1.zoom(-1.04); camera2 = new Camera(this, xMid, yMid, 730000, xMid, yMid, 2035); camera2.zoom(-1.04); camera3 = new Camera(this, xMid, 730000, 2035, xMid, yMid, 2035); camera3.zoom(-1.04); camera1.feed(); println(xMid + ", " + yMid + ", " + zMid); } void setupGraphLines() { lines = new GraphLine[0]; int glColor = 192; lines = (GraphLine[]) append(lines, new GraphLine(14, glColor, -50, 0, 0, 8500, 0, 0)); lines = (GraphLine[]) append(lines, new GraphLine(14, glColor, 0, 50, 0, 0,-5000, 0)); lines = (GraphLine[]) append(lines, new GraphLine(14, glColor, 0, 0, -50, 0, 0, 5000)); lines = (GraphLine[]) append(lines, new GraphLine(14, glColor, -50,-5000, 0, 8500,-5000, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -5000, 1000, 8500, -5000, 1000)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -5000, 2000, 8500, -5000, 2000)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -5000, 3000, 8500, -5000, 3000)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -5000, 4000, 8500, -5000, 4000)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -1000, 0, 8500, -1000, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -2000, 0, 8500, -2000, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -3000, 0, 8500, -3000, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, -50, -3999, 0, 8500, -3999, 0)); //aliasing lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 1096, 0, 0, 1096, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 2192, 0, 0, 2192, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 3286, 0, 0, 3287, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 4383, 0, 0, 4383, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 5479, 0, 0, 5479, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 6575, 0, 0, 6575, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 7670, 0, 0, 7670, 50, 0)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 1096, 0, 0, 1096, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 2192, 0, 0, 2192, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 3286, 0, 0, 3287, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 4383, 0, 0, 4383, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 5479, 0, 0, 5479, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 6575, 0, 0, 6575, 0, -50)); lines = (GraphLine[]) append(lines, new GraphLine(12, glColor, 7670, 0, 0, 7670, 0, -50)); } void setupText() { f1 = loadFont("Georgia-BoldItalic-100.vlw"); f2 = loadFont("Georgia-80.vlw"); textAlign(CENTER); labels = new SuperText[0]; color c = color(51); labels = (SuperText[]) append(labels, new SuperText("Date", c,4000,500,0,0,0,0)); labels = (SuperText[]) append(labels, new SuperText("Miles / Gallon", c,-400,-2000,0,0,0,90)); labels = (SuperText[]) append(labels, new SuperText("Date", c,4000,0,-500,90,0,0)); labels = (SuperText[]) append(labels, new SuperText("Gas Cost / Gallon", c,-400,0,2000,90,0,90)); ticks = new SuperText[0]; c = color(127); ticks = (SuperText[]) append(ticks, new SuperText("1/1/00", c,0,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/00", c,0,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/01", c,1096,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/01", c,1096,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/02", c,2192,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/02", c,2192,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/03", c,3287,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/03", c,3287,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/04", c,4383,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/04", c,4383,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/05", c,5479,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/05", c,5479,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/06", c,6575,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/06", c,6575,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/07", c,7670,200,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("1/1/07", c,7670,0,-200,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("0", c,-100,50,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("10", c,-100,-950,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("20", c,-100,-1950,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("30", c,-100,-2950,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("40", c,-100,-3950,0,0,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("$0", c,-100,0,-50,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("$1", c,-100,0,950,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("$2", c,-100,0,1950,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("$3", c,-100,0,2950,90,0,0)); ticks = (SuperText[]) append(ticks, new SuperText("$4", c,-100,0,3950,90,0,0)); } void keyPressed() { //println("pressed : " + keyCode); if (keyCode == 80) // p key isPdown = true; if (keyCode == 79) // o key isOdown = true; switch(keyCode) { case UP: camera1.boom(-10); break; case DOWN: camera1.boom(10); break; case LEFT: camera1.zoom(-0.05); break; case RIGHT: camera1.zoom(0.05); break; case 65: // a key camera1.truck(-10); break; case 68: // d key camera1.truck(10); break; case 87: // w key camera1.dolly(-10); break; case 83: // s key camera1.dolly(10); break; case 61: // + key for(int i=0; i