Browse Source

ported procLinesFunc to processing

master
Nova deViator 6 years ago
parent
commit
e6c5fe56c5
3 changed files with 69 additions and 15 deletions
  1. +9
    -4
      pde/IF3Si/IF3Si.pde
  2. +0
    -5
      pde/IF3Si/functions.pde
  3. +60
    -6
      pde/IF3Si/getLinesData.pde

+ 9
- 4
pde/IF3Si/IF3Si.pde View File

@ -63,11 +63,13 @@ int tilesOverlap;
boolean testPictureToggle = false;
PFont testFont;
// testPattern
boolean testPatternToggle = false;
// fps
PFont fpsFont;
// testPattern
boolean testPatternToggle = false;
// siLines
ArrayList<FloatList> siLinesData;
@ -152,12 +154,13 @@ void setup() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fpsFont = createFont("Ubuntu Mono", 16);
// siLines
}
//////////////////////////////////////////////////////////////////////////////
void draw() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -206,6 +209,8 @@ void draw() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test pattern```````````````````````````````````````````````````|
testPattern(testPatternToggle, // boolean(0), // on/off
2, 0, // img bank & ID
255, // image alpha


+ 0
- 5
pde/IF3Si/functions.pde View File

@ -215,8 +215,3 @@ void textureSphere(PGraphics pg, float rx, float ry, float rz, PImage t) {
// TOOLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

+ 60
- 6
pde/IF3Si/getLinesData.pde View File

@ -12,7 +12,20 @@
ArrayList<FloatList> getLinesData() {
float[][] colors = { // these are taken from http://astro.u-strasbg.fr/~koppen/discharge/discharge.html
{ 3800.0, 0, 0, 0},
{ 4000.0, 150, 0, 150},
{ 4400.0, 120, 0, 255}, // violet
{ 4500.0, 0, 0, 255}, // blue
{ 4800.0, 0, 255, 255}, // cyan
{ 5200.0, 0, 255, 0}, // green
{ 5800.0, 255, 255, 0}, // yellow
{ 6500.0, 255, 0, 0}, // red
{ 7000.0, 80, 0, 0},
{ 7300.0, 0, 0, 0} };
String[] siLinesData;
int threshold = 400;
siLinesData = loadStrings(dataPath(sketchPath + "/silicon_lines.txt"));
ArrayList<FloatList> siLinesList = new ArrayList<FloatList>();
@ -28,17 +41,58 @@ ArrayList<FloatList> getLinesData() {
data_x.append(float(datatemp[i]));
}
}
// process data - add rgb values
//println(data_x.get(0));
float wavelength = data_x.get(0);
for (int i = 0; i < colors.length; i++){
float thisboundary = colors[i][0];
if (i+1 < colors.length){
float nextboundary = colors[i+1][0];
if(wavelength > thisboundary && wavelength < nextboundary) {
int red = round(colors[i][1] + ( ( (colors[i+1][1] - colors[i][1]) / (colors[i+1][0] - colors[i][0]) )
* (wavelength - colors[i][0]) ));
int green = round(colors[i][2] + ( ( (colors[i+1][2] - colors[i][2]) / (colors[i+1][0] - colors[i][0]) )
* (wavelength - colors[i][0]) ));
int blue = round(colors[i][3] + ( ( (colors[i+1][3] - colors[i][3]) / (colors[i+1][0] - colors[i][0]) )
* (wavelength - colors[i][0]) ));
data_x.append(red);
data_x.append(green);
data_x.append(blue);
}
}
}
printArray(data_x);
siLinesList.add(data_x);
}
for(int i = 0; i < siLinesList.size(); i ++) {
println(siLinesList.get(i).get(0));
float wavelength = siLinesList.get(i).get(0);
float intensity = siLinesList.get(i).get(1);
siLinesList.add(data_x);
}
// for(int i = 0; i < siLinesList.size(); i ++) {
// //println(siLinesList.get(i).get(0));
// float wavelength = siLinesList.get(i).get(0);
// float intensity = siLinesList.get(i).get(1);
// if(intensity > threshold && wavelength < 6741 && wavelength > 3950) {
// // (item[1].asInt > threshold) && (item[0].asInt < 6741) && (item[0].asInt > 3950), {
// println(wavelength + " " + intensity);
// }
// }
//printArray(siLinesList);


Loading…
Cancel
Save