Revisions
-
mbostock revised this gist
Dec 20, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains 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 @@ -1 +1,2 @@ license: gpl-3.0 redirect: https://observablehq.com/@d3/orthographic-shading -
mbostock revised this gist
Feb 9, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains 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 @@ license: gpl-3.0 -
mbostock revised this gist
Oct 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -14,7 +14,7 @@ </style> <body> <script src="//d3js.org/d3.v3.min.js"></script> <script> var width = 960, -
mbostock revised this gist
Jun 11, 2015 . 2 changed files with 19 additions and 41 deletions.There are no files selected for viewing
This file contains 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 @@ -2,8 +2,8 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are Part 2 of 3. 1. [Orthographic Grid](/mbostock/2974930) 2. **Orthographic Clipping** 3. [Orthographic Shading](/mbostock/3031319) To see this technique applied to real geographic features, see the [Spinny Globe](/mbostock/1246403) example. This file contains 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 @@ -2,8 +2,8 @@ <meta charset="utf-8"> <style> circle, path { fill: none; stroke: #333; } @@ -14,61 +14,39 @@ </style> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <script> var width = 960, height = 500; var rotate = [-71.03, 42.37], velocity = [.018, .006]; var projection = d3.geo.orthographic() .scale(240) .clipAngle(90); var path = d3.geo.path() .projection(projection); var graticule = d3.geo.graticule(); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); var feature = svg.append("path") .datum(graticule); svg.append("circle") .attr("cx", width / 2) .attr("cy", height / 2) .attr("r", 240); d3.timer(function(elapsed) { projection.rotate([rotate[0] + elapsed * velocity[0], rotate[1] + elapsed * velocity[1]]); feature.attr("d", path); }); </script> -
mbostock revised this gist
Oct 12, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mbostock revised this gist
Jul 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -26,7 +26,7 @@ yStepsSmall = d3.range(-90, 90 + 1, 5); var origin = [-71.03, -42.37], velocity = [.018, .006], t0 = Date.now(); var projection = d3.geo.azimuthal() -
mbostock revised this gist
Jul 9, 2012 . 1 changed file with 9 additions and 11 deletions.There are no files selected for viewing
This file contains 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 @@ -14,7 +14,7 @@ </style> <body> <script src="http://d3js.org/d3.v2.min.js?2.9.6"></script> <script> var width = 960, @@ -26,15 +26,14 @@ yStepsSmall = d3.range(-90, 90 + 1, 5); var origin = [-71.03, -42.37], velocity = [.0018, .006], t0 = Date.now(); var projection = d3.geo.azimuthal() .mode("orthographic") .scale(240); var circle = d3.geo.circle(); var svg = d3.select("body").append("svg") .attr("width", width) @@ -57,14 +56,13 @@ .attr("cy", height / 2) .attr("r", 240); var path = svg.selectAll("path"); d3.timer(function() { var t = Date.now() - t0, o = [origin[0] + t * velocity[0], origin[1] + t * velocity[1]]; projection.origin(o); circle.origin(o); path.attr("d", draw); }); -
mbostock revised this gist
Jul 4, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -4,4 +4,6 @@ Part 2 of 3. 1. [Orthographic Grid](http://bl.ocks.org/2974930) 2. **Orthographic Clipping** 3. [Orthographic Shading](http://bl.ocks.org/3031319) To see this technique applied to real geographic features, see the [Spinny Globe](http://bl.ocks.org/1246403) example. -
mbostock revised this gist
Jul 3, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -3,5 +3,5 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are Part 2 of 3. 1. [Orthographic Grid](http://bl.ocks.org/2974930) 2. **Orthographic Clipping** 3. [Orthographic Shading](http://bl.ocks.org/3031319) -
mbostock revised this gist
Jul 3, 2012 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -1 +1,7 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are at uniform 10º increments of latitude and longitude. Part 2 of 3. 1. [Orthographic Grid](http://bl.ocks.org/2974930) 2. **[Orthographic Clipping](http://bl.ocks.org/3021474)** 3. [Orthographic Shading](http://bl.ocks.org/3031319) -
mbostock revised this gist
Jul 3, 2012 . 2 changed files with 24 additions and 20 deletions.There are no files selected for viewing
This file contains 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 @@ -1,3 +1 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are at uniform 10º increments of latitude and longitude. This file contains 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 @@ -2,36 +2,43 @@ <meta charset="utf-8"> <style> path, circle { fill: none; stroke: #333; } circle { stroke-width: 2px; } </style> <body> <script src="http://d3js.org/d3.v2.min.js?2.8.1"></script> <script> var width = 960, height = 500; var xStepsBig = d3.range(-180, 180, 10), yStepsBig = d3.range(-90, 90, 10), xStepsSmall = d3.range(-180, 180 + 1, 5), yStepsSmall = d3.range(-90, 90 + 1, 5); var origin = [-71.03, -42.37], velocity = [.018, .06]; var projection = d3.geo.azimuthal() .mode("orthographic") .origin(origin) .scale(240); var circle = d3.geo.circle() .origin(origin); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); svg.selectAll(".x") .data(xStepsBig) @@ -54,17 +61,16 @@ .attr("d", draw); d3.timer(function() { origin[0] += velocity[0]; origin[1] += velocity[1]; projection.origin(origin); circle.origin(origin); path.attr("d", draw); }); function draw(d) { d = circle.clip({type: "LineString", coordinates: d}); return d ? "M" + d.coordinates.map(projection).join("L") : null; } </script> -
mbostock revised this gist
Jun 29, 2012 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -2,7 +2,7 @@ <meta charset="utf-8"> <style> circle, path { fill: none; stroke: #333; } @@ -45,6 +45,11 @@ .attr("class", "y") .datum(function(y) { return xStepsSmall.map(function(x) { return [x, y]; }); }); svg.append("circle") .attr("cx", width / 2) .attr("cy", height / 2) .attr("r", 240); var path = svg.selectAll("path") .attr("d", draw); -
mbostock revised this gist
Jun 29, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -21,7 +21,7 @@ var projection = d3.geo.azimuthal() .mode("orthographic") .origin([-71.03, -42.37]) .scale(240); var circle = d3.geo.circle() -
mbostock revised this gist
Jun 29, 2012 . 2 changed files with 5 additions and 3 deletions.There are no files selected for viewing
This file contains 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 @@ -1 +1,3 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are at uniform 10º increments of latitude and longitude. This example demonstrates [bug 691](https://github.com/mbostock/d3/issues/691). This file contains 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 @@ -50,8 +50,8 @@ d3.timer(function() { var origin = projection.origin(), x = origin[0] + .018, y = origin[1] + 0.06; projection.origin([x, y]); circle.origin([x, y]); path.attr("d", draw); -
mbostock revised this gist
Jun 29, 2012 . 1 changed file with 10 additions and 3 deletions.There are no files selected for viewing
This file contains 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 @@ -24,6 +24,9 @@ .origin([-71.03, 42.37]) .scale(240); var circle = d3.geo.circle() .origin(projection.origin()); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) @@ -46,13 +49,17 @@ .attr("d", draw); d3.timer(function() { var origin = projection.origin(), x = origin[0] + .18, y = origin[1] + 0.6; projection.origin([x, y]); circle.origin([x, y]); path.attr("d", draw); }); function draw(d) { d = circle.clip({type: "LineString", coordinates: d}); return d ? "M" + d.coordinates.map(projection).join("L") : "M0,0"; } </script> -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains 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 @@ -24,8 +24,6 @@ .origin([-71.03, 42.37]) .scale(240); var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) @@ -54,7 +52,7 @@ }); function draw(d) { return "M" + d.map(projection).join("L"); } </script> -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -1 +1 @@ The above grid demonstrates an orthographic azimuthal projection. The lines are at uniform 10º increments of latitude and longitude. -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -22,7 +22,7 @@ var projection = d3.geo.azimuthal() .mode("orthographic") .origin([-71.03, 42.37]) .scale(240); var line = d3.svg.line(); -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -21,7 +21,8 @@ var projection = d3.geo.azimuthal() .mode("orthographic") .origin([-71.03, 42.37]) .scale(260); var line = d3.svg.line(); -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -44,6 +44,16 @@ .datum(function(y) { return xStepsSmall.map(function(x) { return [x, y]; }); }); var path = svg.selectAll("path") .attr("d", draw); d3.timer(function() { var origin = projection.origin(); projection.origin([origin[0] + .18, origin[1] + .06]); path.attr("d", draw); }); function draw(d) { return line(d.map(projection)); } </script> -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains 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 @@ -16,8 +16,8 @@ height = 500, xStepsBig = d3.range(-180, 180, 10), yStepsBig = d3.range(-90, 90, 10), xStepsSmall = d3.range(-180, 180 + 6, 6), yStepsSmall = d3.range(-90, 90 + 3, 3); var projection = d3.geo.azimuthal() .mode("orthographic") -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains 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 @@ -16,8 +16,8 @@ height = 500, xStepsBig = d3.range(-180, 180, 10), yStepsBig = d3.range(-90, 90, 10), xStepsSmall = d3.range(-180, 180, 6), yStepsSmall = d3.range(-90, 90, 3); var projection = d3.geo.azimuthal() .mode("orthographic") -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains 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 @@ -14,15 +14,14 @@ var width = 960, height = 500, xStepsBig = d3.range(-180, 180, 10), yStepsBig = d3.range(-90, 90, 10), xStepsSmall = d3.range(-180, 180, 1), yStepsSmall = d3.range(-90, 90, 1); var projection = d3.geo.azimuthal() .mode("orthographic") .origin([-71.03, 42.37]); var line = d3.svg.line(); -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -20,7 +20,9 @@ yStepsSmall = d3.range(-90, 90, 2); var projection = d3.geo.azimuthal() .mode("orthographic") .scale(380) .origin([-71.03,42.37]); var line = d3.svg.line(); -
mbostock revised this gist
Jun 22, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -19,7 +19,8 @@ xStepsSmall = d3.range(-180, 180, 4), yStepsSmall = d3.range(-90, 90, 2); var projection = d3.geo.azimuthal() .mode("gnomonic"); var line = d3.svg.line(); -
mbostock revised this gist
Jun 22, 2012 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains 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 @@ -1 +1 @@ The above grid shows the distortion of Azimuthal Projection. This file contains 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 @@ -19,7 +19,7 @@ xStepsSmall = d3.range(-180, 180, 4), yStepsSmall = d3.range(-90, 90, 2); var projection = d3.geo.azimuthal(); var line = d3.svg.line(); @@ -42,6 +42,6 @@ .datum(function(y) { return xStepsSmall.map(function(x) { return [x, y]; }); }); var path = svg.selectAll("path") .attr("d", function(d) { return line(d.map(projection)); }); </script> -
mbostock revised this gist
Jun 22, 2012 . 3 changed files with 7 additions and 68 deletions.There are no files selected for viewing
This file contains 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 @@ -1 +1 @@ The above grid shows the distortion of Albers Projection. This file contains 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 @@ -1,45 +0,0 @@ This file contains 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 @@ -2,11 +2,6 @@ <meta charset="utf-8"> <style> path { fill: none; stroke: #333; @@ -15,17 +10,16 @@ </style> <body> <script src="http://d3js.org/d3.v2.min.js?2.8.1"></script> <script> var width = 960, height = 500, xStepsBig = d3.range(-180, 180, 20), yStepsBig = d3.range(-90, 90, 10), xStepsSmall = d3.range(-180, 180, 4), yStepsSmall = d3.range(-90, 90, 2); var albers = d3.geo.albers(); var line = d3.svg.line(); @@ -35,11 +29,6 @@ .append("g") .attr("transform", "translate(-.5,-.5)"); svg.selectAll(".x") .data(xStepsBig) .enter().append("path") @@ -53,11 +42,6 @@ .datum(function(y) { return xStepsSmall.map(function(x) { return [x, y]; }); }); var path = svg.selectAll("path") .attr("d", function(d) { return line(d.map(albers)); }); </script> -
mbostock revised this gist
Jun 20, 2012 . 2 changed files with 49 additions and 6 deletions.There are no files selected for viewing
This file contains 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,45 @@ (function() { d3.fisheye = function() { var radius = 200, power = 2, k0, k1, center = [0, 0]; function fisheye(d) { var dx = d[0] - center[0], dy = d[1] - center[1], dd = Math.sqrt(dx * dx + dy * dy); if (dd >= radius) return d; var k = k0 * (1 - Math.exp(-dd * k1)) / dd * .75 + .25; return [center[0] + dx * k, center[1] + dy * k]; } function rescale() { k0 = Math.exp(power); k0 = k0 / (k0 - 1) * radius; k1 = power / radius; return fisheye; } fisheye.radius = function(_) { if (!arguments.length) return radius; radius = +_; return rescale(); }; fisheye.power = function(_) { if (!arguments.length) return power; power = +_; return rescale(); }; fisheye.center = function(_) { if (!arguments.length) return center; center = _; return fisheye; }; return rescale(); }; })(); This file contains 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 @@ -15,7 +15,7 @@ </style> <body> <script src="http://d3js.org/d3.v2.min.js?2.8.1"></script> <script src="fisheye.js"></script> <script> var width = 960, @@ -27,9 +27,7 @@ var fisheye = d3.fisheye(); var line = d3.svg.line(); var svg = d3.select("body").append("svg") .attr("width", width) @@ -46,13 +44,13 @@ .data(xStepsBig) .enter().append("path") .attr("class", "x") .datum(function(x) { return yStepsSmall.map(function(y) { return [x, y]; }); }); svg.selectAll(".y") .data(yStepsBig) .enter().append("path") .attr("class", "y") .datum(function(y) { return xStepsSmall.map(function(x) { return [x, y]; }); }); var path = svg.selectAll("path") .attr("d", line); -
mbostock revised this gist
Jun 20, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -8,7 +8,7 @@ } path { fill: none; stroke: #333; } -
mbostock revised this gist
Jun 20, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains 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 @@ -8,7 +8,7 @@ } path { fill-opacity: .1; stroke: #333; }
NewerOlder