Skip to main content
100%

Furuti 3 globe clip polygon

✓ Published0🌍 Public
PPhilippe Rivière
Last edited Jun 7, 2017
Created on Mar 8, 2017

A D3.js projection test renders a globe with landmasses and an overlaid polygon, showing how the geographic projection handles clip polygons. The polygon, with exaggerated epsilon, traces an almost-complete sphere boundary, appearing as a green line with a barely visible purple interior. As the globe rotates, the data from a World 110m GeoJSON file is drawn on a Canvas using `d3.geoOrthographic`, `d3.geoPath`, and `d3.timer`. The animation reveals the polygon’s edge behavior across the projected sphere.

AI-generated description

Research for d3-geo's polyhedra projections; issue #86: we need to recreate projection.clipPolygon() at least for this type of polygon.

Polygon coordinates given by adding these lines in src/polyhedra/index.js:

  var polygon = [];
  outline({point: function(λ, φ) { polygon.push([λ, φ]); }}, root);
  polygon.push(polygon[0]);
  console.log(polygon);

Here we exagerated the value of epsilon to show how this works.

With the usual epsilon, the polygon would look like a line, because its “interior” (in purple) covers the whole sphere. The green line is actually the polygon's edge on both sides. The polygon has almost no “exterior” (in white).

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/ba63c55dd2dbc3ab0127'>This Is a Globe</a>

forked from <a href='http://bl.ocks.org/Fil/'>Fil</a>'s block: <a href='http://bl.ocks.org/Fil/48734366b4d64aa1b26bd256ee8f7c5e'>Furuti 3 globe clip polygon</a>

gpl-3.0 Licensed

Similar vizzes