import tomc.gpx.*; import com.processinghacks.arcball.*; GPX gpx; ArcBall arcball; void setup() { size(600,400,P3D); arcball = new ArcBall(this); gpx = new GPX(this); gpx.parse("newzealand_fucked.gpx"); } void draw() { background(255); lights(); rectMode(CENTER); ellipseMode(CENTER); translate(width/2,height/2,-height/2); fill(230); noStroke(); sphere(0.9999*height/2); noFill(); stroke(0); for (int i = 0; i < gpx.getTrackCount(); i++) { GPXTrack trk = gpx.getTrack(i); for (int j = 0; j < trk.size(); j++) { GPXTrackSeg trkseg = trk.getTrackSeg(j); beginShape(LINE_STRIP); for (int k = 0; k < trkseg.size(); k++) { GPXPoint pt = trkseg.getPoint(k); double r = height/2 * (pt.ele + 6367.47000) / 6367.47000; double x = r * Math.sin(pt.lat) * Math.cos(pt.lon); double y = r * Math.sin(pt.lat) * Math.sin(pt.lon); double z = r * Math.cos(pt.lat); vertex(x,y,z); } endShape(); } } } // // convenience method which casts doubles to floats // because the GPX functions use doubles... // void vertex(double x, double y, double z) { vertex((float)x,(float)y,(float)z); }