diff options
| author | git@eclectronics.org <git@eclectronics.org@eclectronics.org> | 2012-02-19 23:38:58 +0000 |
|---|---|---|
| committer | git@eclectronics.org <git@eclectronics.org@eclectronics.org> | 2012-02-19 23:38:58 +0000 |
| commit | 6bc8d43cc205e00485c865de4b04d93c4270ff22 (patch) | |
| tree | f913d9b1201117609c9eadb35866318ff65eacc4 /vodaviz.pde | |
| parent | d6ffb40609d3fedcb2f4cae9ab64ebc7ac7f6521 (diff) | |
perspective circles + sampling working
Diffstat (limited to 'vodaviz.pde')
| -rw-r--r-- | vodaviz.pde | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/vodaviz.pde b/vodaviz.pde index 35b5941..e7ac204 100644 --- a/vodaviz.pde +++ b/vodaviz.pde @@ -171,6 +171,25 @@ RPoint GCircFract(RPoint sp,RPoint ep,float f) { float z = A*sin(sp.y) + B*sin(ep.y); return new RPoint(atan2(y,x),atan2(z,sqrt(pow(x,2)+pow(y,2)))); } +void ellipse3d(RPoint pos,float s,float r){ + //take ellipse coord in UV space + //return in 3d globe space + float er=s*0.5; + curveTightness(-0.67); + RPoint s1=smap.per(new RPoint(pos.x-er,pos.y),r); + RPoint s2=smap.per(new RPoint(pos.x,pos.y-er),r); + RPoint s3=smap.per(new RPoint(pos.x+er,pos.y),r); + RPoint s4=smap.per(new RPoint(pos.x,pos.y+er),r); + beginShape(); + curveVertex(s1.x+hw, s1.y+hh); + curveVertex(s2.x+hw, s2.y+hh); + curveVertex(s3.x+hw, s3.y+hh); + curveVertex(s4.x+hw, s4.y+hh); + curveVertex(s1.x+hw, s1.y+hh); + curveVertex(s2.x+hw, s2.y+hh); + curveVertex(s3.x+hw, s3.y+hh); + endShape(); +} RShape shp; pointNormalise pnorm; @@ -186,6 +205,8 @@ bitmapcountry Ireland; bezierstroke bstroke; gradientstroke3D gstroke; +float hw,hh; + PImage lightmap; color bg,fg; @@ -194,13 +215,16 @@ void setup(){ RG.init(this); mode="PDF"; - if (mode=="PDF") size(832,220,PDF, "vodaviz_lines_170212_b.pdf"); //P3D); //832,220); //nb pdf is 800x600 + if (mode=="PDF") size(832,220,PDF, "vodaviz_circles_190212.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 bg=color(164,215,244); fg=color(#D2131D); + hw=width/2; + hh=height/2; + smooth(); float m = millis(); @@ -229,7 +253,7 @@ void setup(){ RG.ignoreStyles(); println("loaded svg in "+((millis()-m)*.001)+" seconds"); - Ireland=new bitmapcountry("Ireland",0,0,shp.children[0]); + Ireland=new bitmapcountry("Ireland",0,0,0,0,0,0,shp.children[0]); Ireland.analyse(18.279,746.302,109,374.293); data=new csvloader("calls.csv"); calls=new calldata(data.data,shp,"countries5.xml",this); @@ -285,11 +309,13 @@ void draw() { } } } - //fill(fg); + // //pick a random colour - //fg=color(random(150)+10,random(150)+10,random(150)+10); - stroke(fg); + fg=color(random(150)+10,random(150)+10,random(150)+10); + //stroke(fg); + noStroke(); + fill(fg); //stroke(0,0,0,50); @@ -341,11 +367,13 @@ void draw() { if (true) { //draw gradient 3D lines if (calls.countries.get(i).points.size()>0) { for (int j=0;j<log10(calls.countries.get(i).calls)*15;j++) { - RPoint Sp=ptrans.form(pnorm.alise(calls.countries.get(i).getpoint())); + weightedpixel px=calls.countries.get(i).getpixel(); + RPoint Sp=ptrans.form(pnorm.alise(px.randompt(5.0))); RPoint Ep=ptrans.form(pnorm.alise(Ireland.getpoint())); - gstroke.drawstroke(Sp,Ep,fg); + //gstroke.drawstroke(Sp,Ep,fg); //RPoint Dp=smap.per(Sp,4); //ellipse(Dp.x+hw,Dp.y+hh,2,2); + ellipse3d(Sp,(px.bright*.00001)+.000002,4); } } } |
