mbostock/d3 — pull request #839 by jasondavies (2012-10-04 10:17:25+00:00)
Title: Better resampling for non-linear distortions.

I've reinstated the original conditional for linear longitudinal interpolation, since the x * x < ε conditional was not tight enough and hence caused glitches in projections that include the poles e.g. stereographic.

Back to solving the issue that was primarily noticeable in the Albers demo: graticules near the poles would not resample correctly. We made an assumption that a point mid-way along the connecting great arc is going to be approximately mid-way in pixel-space. This is a reasonable
assumption in most cases, but there is an area of high instability near the poles, since a small change in distance could result in a large change in longitude, e.g. imagine a great arc going right over a pole, so the longitude will change greatly depending on which side of the pole you're on.

So the new fix is to see if the distance in pixel-space hardly changed at all, and in this case we attempt to interpolate again, mid-way to the new spherical coordinates. I think we can probably improve this even further by borrowing methods from standard root-finding techniques e.g. Newton–Raphson.