diff options
| -rw-r--r-- | parsecalldata.pde | 2 | ||||
| -rw-r--r-- | vodaviz.pde | 43 |
2 files changed, 31 insertions, 14 deletions
diff --git a/parsecalldata.pde b/parsecalldata.pde index 6e410d4..4b1b1b1 100644 --- a/parsecalldata.pde +++ b/parsecalldata.pde @@ -15,7 +15,7 @@ class country{ String name; float calls,mins,aloc,user,asr,ner; int networks; - transient RShape outline; + RShape outline; country(String n,float c,float m,float al,float u,float as,float ne,RShape shp){ name=n; calls=c; diff --git a/vodaviz.pde b/vodaviz.pde index 368d2c8..d9018db 100644 --- a/vodaviz.pde +++ b/vodaviz.pde @@ -119,8 +119,8 @@ void setup(){ println("vodaviz v0.6"); RG.init(this); - //mode="PDF"; - if (mode=="PDF") size(832,220,PDF, "vodaviz_lines_220212.pdf"); //P3D); //832,220); //nb pdf is 800x600 + mode="PDF"; + if (mode=="PDF") size(832,220,PDF, "vodaviz_circles_270212.pdf"); //P3D); //832,220); //nb pdf is 800x600 else size(832,220); //,PDF, "testoutput.pdf"); //P3D); //832,220); //nb pdf is 800x600 // C. 33 - M. 3 - Y. 0 - K. 0 @@ -217,10 +217,10 @@ void draw() { // //pick a random colour - //colorMode(HSB); - //fg=color(random(255),255,150,255); - //fill(fg); - //noStroke(); + colorMode(HSB); + fg=color(random(255),255,150,255); + fill(fg); + noStroke(); //stroke(fg); //noFill(); @@ -273,7 +273,7 @@ void draw() { //println("plotting "+calls.countries.get(i).name+": "+calls.countries.get(i).calls+" calls"); } - if (true) { //draw gradient 3D lines + if (false) { //draw gradient 3D lines if (calls.countries.get(i).points.size()>0) { for (int j=0;j<log10(calls.countries.get(i).calls)*1;j++) { //was *15 weightedpixel px=calls.countries.get(i).getpixel(); @@ -284,21 +284,38 @@ void draw() { } } } - if (false) { //draw area call based circles + if (true) { //draw area call based circles println("drawing "+calls.countries.get(i).name+", calls "+calls.countries.get(i).calls); float ascale=0.001; if (calls.countries.get(i).points.size()>0) { float area=calls.countries.get(i).calls; while (area>0) { weightedpixel px=calls.countries.get(i).getpixel(); - RPoint Sp=ptrans.form(pnorm.alise(px.randompt(5.0))); + RPoint Sp=px.randompt(0.0); //float b=min(px.bright,pow(area,0.5)/ascale); - float b=200; + float b=100; area-=(pow(b,2)*ascale)+1; - + float cdiam=(b*.02)+.1; + + //scale shapes at edges + boolean fits=false; + while (!fits) { + RPoint[] tc=new RPoint[4]; + + tc[0]=new RPoint(Sp.x-cdiam,Sp.y-cdiam); + tc[1]=new RPoint(Sp.x+cdiam,Sp.y-cdiam); + tc[2]=new RPoint(Sp.x+cdiam,Sp.y+cdiam); + tc[3]=new RPoint(Sp.x-cdiam,Sp.y+cdiam); + + if (calls.countries.get(i).outline.contains(Sp)) fits=true; + else { + cdiam*=0.8; + print("."); + } + } //ellipse3d(Sp,(b*.00002)+.000002,4); - RPoint Dp=smap.per(Sp,4); - ellipse(Dp.x+hw,Dp.y+hh,(b*.02)+.1,(b*.02)+.1); + RPoint Dp=smap.per(ptrans.form(pnorm.alise(Sp)),4); + ellipse(Dp.x+hw,Dp.y+hh,cdiam,cdiam); } } } |
