summaryrefslogtreecommitdiff
path: root/vodaviz.pde
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2012-02-05 22:35:15 +0000
committerTim Redfern <tim@eclectronics.org>2012-02-05 22:35:15 +0000
commit6c30a96f17e57ff8441cbc19306651d5d288301e (patch)
treed7ab64db7dd792a12e63b712393e5449094a3bfa /vodaviz.pde
parent9a84f8a9f1fd79e238a7149130df026088628938 (diff)
ready to draw lines
Diffstat (limited to 'vodaviz.pde')
-rw-r--r--vodaviz.pde34
1 files changed, 30 insertions, 4 deletions
diff --git a/vodaviz.pde b/vodaviz.pde
index 58c2348..f95ee14 100644
--- a/vodaviz.pde
+++ b/vodaviz.pde
@@ -74,6 +74,8 @@ class pointMapper {
//screen plane at 0,0,100
//(dx-ex)(ez/dz)
//(dy-ey)(ez/dz)
+
+ //rotate camera
return new RPoint(x*(100/z),y*(100/z));
}
@@ -84,14 +86,21 @@ pointMapper shpmap;
//RRectangle cb;
int whichChild,numChildren;
+String mode;
+
void setup(){
println("vodaviz v0.11");
RG.init(this);
- size(832,220); //PDF, "testoutput.pdf"); //P3D); //832,220); //nb pdf is 800x600
+
+ mode="PDF";
+ size(832,220); //,PDF, "testoutput.pdf"); //P3D); //832,220); //nb pdf is 800x600
+
smooth();
float m = millis();
- shp = RG.loadShape("world_countries_outlines_split.svg");
+ shp = RG.loadShape("world_countries_outlines_culled.svg"); //test_drawing.svg"); //world_countries_outlines_split.svg");
+
+
shpmap = new pointMapper(26,736,90,390);
RG.ignoreStyles();
println("loaded svg in "+((millis()-m)*.001)+" seconds");
@@ -115,8 +124,24 @@ void draw() {
//plot shapes at points
for (int i=0;i<numChildren;i++) {
String cmd="";
- for (int j=0;j<shp.children[i].paths.length;j++) {
+ for (int j=0;j<shp.children[i].paths.length;j++) { //
//shp.children[i].paths[j].draw();
+
+ //public boolean contains(RPoint p)
+
+ /*
+ //find a random point inside shape
+ RPoint tl=shp.children[i].getTopLeft();
+ RPoint br=shp.children[i].getBottomRight();
+ RPoint np;
+ boolean found =false;
+ while (!found) {
+ np=new RPoint(random(tl.x,br.x),random(tl.y,br.y));
+ found = shp.children[i].contains(np); //paths[j].
+ println(shp.children[i].name+"; trying "+np.x+","+np.y+" between "+tl.x+","+tl.y+" and "+br.x+","+br.y+" :"+found);
+ }
+ */
+
beginShape();
for (int k=0;k<shp.children[i].paths[j].commands.length;k++) {
RPoint sp=shp.children[i].paths[j].commands[k].startPoint;
@@ -126,11 +151,12 @@ void draw() {
//if (i==0&&j==0) cmd+=(x+(getWidth()/2))+","+(y+(getHeight()/2))+","+z+" ";
}
endShape();
+
}
if (cmd!="") println(cmd);
}
noLoop();
- // exit();
+ if (mode=="PDF") exit();
}
void mousePressed() {