float a; float dy = 16; int k = 0; int detectorAngles = 9; int ellipsex; int ellipsey; int ellipseflag = 0; int numvertices = 3; int inc = 0; int numRays; float[] polydata = new float[2*numvertices]; int[][] testRay; Reconstruction[] backProjection = new Reconstruction[detectorAngles]; void setup() { size(1536, 512); stroke(255); smooth(); numRays = height; a = height; testRay = new int[detectorAngles][numRays+1]; background(0); } void mousePressed() { ellipsex = mouseX; ellipsey = mouseY; ellipseflag = 1; } void Polygon(){ beginShape(); for(int m = 0; m < numvertices; m=m+1) { vertex(ellipsex/2*cos(2*PI*m/numvertices),ellipsey/2*sin(2*m*PI/numvertices)); polydata[2*m] = ellipsex/2*cos(2*PI*m/numvertices); polydata[2*m+1] = ellipsey/2*sin(2*PI*m/numvertices); } endShape(CLOSE); } void draw() { float angle; float xtest, ytest; int insidetest = 0; int jj; int numRays = 2*int(height) / int(dy); fill(0); rect(0,0,width/3,height); line(2*width/3,0,2*width/3,height); if (ellipseflag==0){ print("Use the mouse to select the ellipse size, referenced to top left corner\n"); } if (mousePressed == true) { Polygon(); } if (ellipseflag==1){ if (k == detectorAngles) { k = 0; noLoop(); } if(k1.0){ stroke(2*testRay[k][g],Opacity); } else { stroke(25,Opacity); } } else { if(testRay[k][g]>1.0){ stroke(255,Opacity); } else { stroke(50,Opacity); } } line(-width/12, (a-g*dy)/4, width/12, (a-g*dy)/4); } stroke(255); } }