Open mbostock opened 11 years ago
Nice! A minor improvement could be to use d3.geo.interpolate for center.
That reminds me, there’s a related problem where the interpolated projection can get out of sync with its a & b projections if their center or translate changes after alpha is set. I debate whether it’s a requirement that the interpolated projection be a “view” on its constituent projection, but at the same time there’s no way to take a snapshot of a projection so the alternative is to allow undefined behavior.
Maybe it would be cleaner to interpolate raw projection functions instead, but then you’d have to expose some other API for interpolating changes to scale, center, translate, rotate, etc. Also that would avoid trying to interpolate changes in clipping behavior, which isn’t possible.
Perhaps we should consider adding projection.copy()
, similar to scale.copy()
? I think we’ve come across other situations where it might have been useful in the past.
I’m not sure if it’s really possible to copy projections with custom streams though, like the current implementation of d3.geo.hammerRetroazimuthal.
Another idea could be to allow projection.center(null)
, which would disable center altogether.
Is there any improvement since then? I can't find any other solution to interpolate projections.
Btw, I find this solution pretty complex. For example, how to add an invert
method, or how to animate clipAngle
, etc. Also, why this fails with Mercator projection?
Maybe d3-geo (or d3-geo-projection) should add a built-in function?
If I'm totally off-topic, please let me know ;-)
I wonder if this is worth adding:
Taken from http://bl.ocks.org/mbostock/5731632