From 5a68500983aba528b0add0d2bc22abfc092c508a Mon Sep 17 00:00:00 2001 From: "git@eclectronics.org" Date: Thu, 16 Feb 2012 16:46:43 +0000 Subject: drawing 3d calpaths --- vodaviz.pde | 109 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 25 deletions(-) (limited to 'vodaviz.pde') diff --git a/vodaviz.pde b/vodaviz.pde index d12db59..3f104a0 100644 --- a/vodaviz.pde +++ b/vodaviz.pde @@ -78,6 +78,17 @@ The intermediate latitude and longitude is then given by: drawing - circles (fixed diameter), closed shape made of 2 bezier curves +paths above 3d globe +fix missing countries +render above map +colours +sort lines according to destination ? + +match 3D map or render texture out of processing +or export 3d lines - dx + +cache points! + */ import processing.pdf.*; @@ -108,7 +119,7 @@ class pointTransform { RPoint form(RPoint in) { //transform - return new RPoint (((in.x*0.25)+(PI/2)),((in.y)*0.3)+(PI/2)); //front half of sphere + return new RPoint (((in.x*0.053)+(PI/2)-.01),((in.y)*0.14)+(PI/2)-.1); //front half of sphere } } @@ -120,9 +131,9 @@ class sphereMap { //map to 3D sphere float r=getHeight()*_r; - float x=r*cos(p.x)*(sin(p.y)) *2; - float z=r*sin(p.x)*(sin(p.y))-985; - float y=r*cos(p.y)+(getHeight()*0.5)-210; + float x=r*cos(p.x)*(sin(p.y)) *4; + float z=r*sin(p.x)*(sin(p.y)) -985; + float y=r*cos(p.y)+(getHeight()*1)-330; //camera at 0,0,0 //screen plane at 0,0,100 @@ -173,6 +184,7 @@ calldata calls; bitmapcountry Ireland; bezierstroke bstroke; +gradientstroke3D gstroke; PImage lightmap; color bg,fg; @@ -182,12 +194,12 @@ void setup(){ RG.init(this); //mode="PDF"; - if (mode=="PDF") size(832,220,PDF, "vodaviz_test_140212.pdf"); //P3D); //832,220); //nb pdf is 800x600 + if (mode=="PDF") size(832,220,PDF, "vodaviz_bg_160212.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(255,255,255); + fg=color(#D2131D); smooth(); float m = millis(); @@ -198,7 +210,7 @@ void setup(){ ptrans = new pointTransform(); smap = new sphereMap(); - lightmap=loadImage("earth_lights.gif"); + lightmap=loadImage("vodaviz_bg_160212.png"); float startsize=0.2; float endsize=0.1; @@ -208,6 +220,13 @@ void setup(){ float bezierfract=0.25; bstroke = new bezierstroke(startsize,endsize,linewidth,mpfract,raisefract,bezierfract); + startsize=10; + endsize=.5; + float[] transpos={0.0,0.15,0.85,1.0}; + float[] transamt={0.5,0.2,0.2,0.5}; + color col=color(0,0,0); + gstroke=new gradientstroke3D(startsize,endsize,transpos,transamt,col,smap); + RG.ignoreStyles(); println("loaded svg in "+((millis()-m)*.001)+" seconds"); Ireland=new bitmapcountry("Ireland",0,0,shp.children[0]); @@ -218,7 +237,7 @@ void setup(){ background(255,255,255); noFill(); stroke(255); - strokeWeight(.02); + strokeWeight(.002); if (false) { //check worked example http://williams.best.vwh.net/avform.htm#Example RPoint LAX=new RPoint(2.066470,0.592539); @@ -238,35 +257,68 @@ int j=0; void draw() { noStroke(); + float hw=getWidth()/2; + float hh=getHeight()/2; if (i==0) { - //image(lightmap,0,0,getWidth(),getHeight()); - fill(bg); - rect(0,0,width,height); + image(lightmap,0,0,getWidth(),getHeight()); + //fill(bg); + //rect(0,0,width,height); + //background(0); + + if (false) { //render lightmap in 3D + float pw=0.5/lightmap.width; + float ph=0.5/lightmap.height; + for (int j=0;j