diff --git a/d3.geo.js b/d3.geo.js index a7fb4cea..c7c021cf 100644 --- a/d3.geo.js +++ b/d3.geo.js @@ -627,7 +627,7 @@ d3.geo.greatCircle = function() { radius = 6371; // Mean radius of Earth, in km. // TODO: breakAtDateLine? - function greatCircle(d, i, dist) { + function greatCircle(d, i) { var from = source.call(this, d, i), to = target.call(this, d, i), x0 = from[0] * d3_radians, @@ -638,15 +638,13 @@ d3.geo.greatCircle = function() { cy0 = Math.cos(y0), sy0 = Math.sin(y0), cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), - d = dist || Math.acos(sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)), + d = Math.acos(sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)), sd = Math.sin(d), f = d / (n - 1), e = -f, path = [], i = -1; - if (d === 0) return [from]; - while (++i < n) { e += f; var A = Math.sin(d - e) / sd, diff --git a/d3.geo.min.js b/d3.geo.min.js index c7664e9c..ddfd17fa 100644 --- a/d3.geo.min.js +++ b/d3.geo.min.js @@ -1 +1 @@ -(function(){function q(a,b,c){var d=-1,e=a.length,f=0,g=Infinity;while(++d50?b:f<-140?c:g<21?d:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);e.scale=function(f){if(!arguments.length)return a.scale();a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5);return e.translate(a.translate())},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]);return e};return e.scale(a.scale())},d3.geo.mercator=function(){function d(d){var e=d[0]/360,f=-(Math.log(Math.tan(Math.PI/4+d[1]*a/2))/a)/360;return[b*e+c[0],b*Math.max(-0.5,Math.min(.5,f))+c[1]]}var b=500,c=[480,250];d.invert=function(d){var e=(d[0]-c[0])/b,f=(d[1]-c[1])/b;return[360*e,2*Math.atan(Math.exp(-360*f*a))/a-90]},d.scale=function(a){if(!arguments.length)return b;b=+a;return d},d.translate=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return d};return d},d3.geo.path=function(){function o(a){return Math.abs(d3.geom.polygon(a.map(f)).area())}function m(a){var b=d3.geom.polygon(a[0].map(f)),c=b.centroid(1),d=c[0],e=c[1],g=Math.abs(b.area()),h=0,i=a.length;while(++hd&&(d=a),ef&&(f=e)});return[[b,c],[d,f]]};var f={Feature:g,FeatureCollection:h,LineString:i,MultiLineString:j,MultiPoint:i,MultiPolygon:k,Point:l,Polygon:m};d3.geo.greatCircle=function(){function f(e,f,g){var h=b.call(this,e,f),i=c.call(this,e,f),j=h[0]*a,k=h[1]*a,l=i[0]*a,m=i[1]*a,n=Math.cos(j),o=Math.sin(j),p=Math.cos(k),q=Math.sin(k),r=Math.cos(l),s=Math.sin(l),t=Math.cos(m),u=Math.sin(m),e=g||Math.acos(q*u+p*t*Math.cos(l-j)),v=Math.sin(e),w=e/(d-1),x=-w,y=[],f=-1;if(e===0)return[h];while(++f50?b:f<-140?c:g<21?d:a)(e)}var a=d3.geo.albers(),b=d3.geo.albers().origin([-160,60]).parallels([55,65]),c=d3.geo.albers().origin([-160,20]).parallels([8,18]),d=d3.geo.albers().origin([-60,10]).parallels([8,18]);e.scale=function(f){if(!arguments.length)return a.scale();a.scale(f),b.scale(f*.6),c.scale(f),d.scale(f*1.5);return e.translate(a.translate())},e.translate=function(f){if(!arguments.length)return a.translate();var g=a.scale()/1e3,h=f[0],i=f[1];a.translate(f),b.translate([h-400*g,i+170*g]),c.translate([h-190*g,i+200*g]),d.translate([h+580*g,i+430*g]);return e};return e.scale(a.scale())},d3.geo.mercator=function(){function d(d){var e=d[0]/360,f=-(Math.log(Math.tan(Math.PI/4+d[1]*a/2))/a)/360;return[b*e+c[0],b*Math.max(-0.5,Math.min(.5,f))+c[1]]}var b=500,c=[480,250];d.invert=function(d){var e=(d[0]-c[0])/b,f=(d[1]-c[1])/b;return[360*e,2*Math.atan(Math.exp(-360*f*a))/a-90]},d.scale=function(a){if(!arguments.length)return b;b=+a;return d},d.translate=function(a){if(!arguments.length)return c;c=[+a[0],+a[1]];return d};return d},d3.geo.path=function(){function o(a){return Math.abs(d3.geom.polygon(a.map(f)).area())}function m(a){var b=d3.geom.polygon(a[0].map(f)),c=b.centroid(1),d=c[0],e=c[1],g=Math.abs(b.area()),h=0,i=a.length;while(++hd&&(d=a),ef&&(f=e)});return[[b,c],[d,f]]};var f={Feature:g,FeatureCollection:h,LineString:i,MultiLineString:j,MultiPoint:i,MultiPolygon:k,Point:l,Polygon:m};d3.geo.greatCircle=function(){function f(e,f){var g=b.call(this,e,f),h=c.call(this,e,f),i=g[0]*a,j=g[1]*a,k=h[0]*a,l=h[1]*a,m=Math.cos(i),n=Math.sin(i),o=Math.cos(j),p=Math.sin(j),q=Math.cos(k),r=Math.sin(k),s=Math.cos(l),t=Math.sin(l),e=Math.acos(p*t+o*s*Math.cos(k-i)),u=Math.sin(e),v=e/(d-1),w=-v,x=[],f=-1;while(++f