//Data obtained from: R. Abbasi et al., Phys. Rev. D 79, 062001 (2009).
//Drawing created by Ron F. Shvartsman in the Generative Design Processes Course at SCI-Arc.
//Instructed by Jeremy Rotsztain.
//This drawing is a study of Neutrino Data and and its behavorial relationships through a course
//undertaken at SCI-Arc Post-Graduate MediaSCAPES Program.
//import processing.video.*;
import peasy.test.*;
import peasy.org.apache.commons.math.*;
import peasy.*;
import peasy.org.apache.commons.math.geometry.*;
//MovieMaker mm;
PeasyCam cam;
Particle particleSystem;
float numFrames = 5000;
float lon;
float lat;
int energy;
float direction;
//declare data arrays
float[] dataDEC;
float[] dataRA;
int[] dataNRG;
float[] dataDIR;
void setup() {
size(900,900,P3D);
//mm = new MovieMaker(this, 900, 900, "neutrino_cloud.mov", 24, MovieMaker.JPEG, MovieMaker.LOSSLESS);
smooth();
cam = new PeasyCam(this, 100);
cam.setMinimumDistance(10);
cam.setMaximumDistance(5000);
//strokeWeight(0);
noFill();
stroke(255);
strokeWeight(1);
particleSystem = new Particle(lon,lat,energy,direction);
//Load text file as a String
String[] DEC = loadStrings("DEC.txt");
String[] RA = loadStrings("RA.txt");
String[] NRG = loadStrings("NRG.txt");
String[] DIR = loadStrings("DIR.TXT");
//Convert string into an array of integers
//using ',' as a delimiter
dataDEC = float(split(DEC[0],','));
dataRA = float(split(RA[0],','));
dataNRG = int(split(NRG[0],','));
dataDIR = float(split(DIR[0],','));
//println(DEC);
//println(RA);
//println(NRG);
}
void draw() {
rotateX(-.5);
rotateY(-.5);
background(0);
fill(255,0,0);
pushMatrix();
fill(0,0,255);
popMatrix();
background(0);
particleSystem.drawData();
//if (frameCount <= numFrames) {
//saveFrame("dataStills=####.png");
//}
//mm.addFrame();
}
class Particle {
float lat;
float lon;
int energy;
float direction;
Particle(float latp, float lonp, int energyp, float directionp) {
latp = lat;
lonp = lon;
energyp = energy;
directionp = direction;
}
void drawData() {
//loop through data elements
for (int i = 0; i<6595; i+=1) {
float lon = dataDEC[i]*8;
float lat = dataRA[i]*8;
int energy = dataNRG[i]*8;
float dir = dataDIR[i]*8;
//convert degrees to radians
float radLon = radians(lon);
float radLat = radians(lat);
float radDir = radians(dir);
//println(radLat);
//convert to spherical coordinates
float x = (energy) * cos(radLat) * sin(radLon);
float y = (energy) * sin(radLat) * sin(radLon);
float z = (energy) * cos(radLon);
//create points based on new spherical data coordinates
stroke(255,255,255,20);
beginShape(POINTS);
vertex(x,y,z);
endShape();
//move poimts based on their angular resolution if they have energy
if (energy > 0) {
dataDEC[i]=dataDEC[i]+dataDIR[i]/20;
dataRA[i]=dataRA[i]+dataDIR[i]/20;
}
//measure the distance between original data and spherical points
float d = dist(dataDEC[i],dataRA[i],dataDIR[i],x,y,z);
stroke(160,0,0,100);
//if the distance is less than 1000 draw a line and alter angular resolution
if (d>1000) {
line(dataDEC[i],dataRA[i],dataDIR[i],x,y,z);
x=x*-1;
y=y*-2;
z=z*-3;
}
//if the distance is less than 2000 draw a line and alter angular resolution
if (d>2000) {
dataDEC[i]*=-1;
}
//if the distance is less than 2000 draw a line and alter angular resolution
if (d>3000) {
dataDIR[i]*=-1;
}
}
}
}
//Data obtained from: R. Abbasi et al., Phys. Rev. D 79, 062001 (2009).
//Drawing created by Ron F. Shvartsman in the Generative Design Processes Course at SCI-Arc.
//Instructed by Jeremy Rotsztain.
//This drawing is a study of Neutrino Data and and its behavorial relationships through a course
//undertaken at SCI-Arc Post-Graduate MediaSCAPES Program.