Created
October 22, 2011 22:36
Revisions
-
Cemre Güngör created this gist
Oct 22, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ void drawPath(float lat1, float lon1, float lat2, float lon2) { stroke(0); strokeWeight(5); noFill(); lat1 *= PI/180; lon1 *= PI/180; lat2 *= PI/180; lon2 *= PI/180; beginShape(); float d, f, A, B, x, y, z, latN, lonN; int n; d = 2*asin(sqrt( pow((sin((lat1-lat2)/2)),2) + cos(lat1)*cos(lat2)*pow((sin((lon1-lon2)/2)),2))); println(d); for (n = 0 ; n < (SENSITIVITY + 1) ; n++ ) { f = (1/SENSITIVITY) * n; A = sin((1-f)*d)/sin(d); B = sin(f*d)/sin(d); x = A*cos(lat1)*cos(lon1) + B*cos(lat2)*cos(lon2); y = A*cos(lat1)*sin(lon1) + B*cos(lat2)*sin(lon2); z = A*sin(lat1) + B*sin(lat2); latN = atan2(z,sqrt(pow(x,2)+pow(y,2))); lonN = atan2(y,x); latN /= PI / 180; lonN /= PI / 180; vertex(lonN, -latN); println(latN + " " + lonN); } endShape(); }