Sha256: c9d3720ac8c4047f0bf41862103278cc3c614f695329847638421baed86ecc3c
Contents?: true
Size: 869 Bytes
Versions: 4
Compression:
Stored size: 869 Bytes
Contents
import "projection"; function polyconic(λ, φ) { if (Math.abs(φ) < ε) return [λ, 0]; var tanφ = Math.tan(φ), k = λ * Math.sin(φ); return [ Math.sin(k) / tanφ, φ + (1 - Math.cos(k)) / tanφ ]; } polyconic.invert = function(x, y) { if (Math.abs(y) < ε) return [x, 0]; var k = x * x + y * y, φ = y * .5, i = 10, δ; do { var tanφ = Math.tan(φ), secφ = 1 / Math.cos(φ), j = k - 2 * y * φ + φ * φ; φ -= δ = (tanφ * j + 2 * (φ - y)) / (2 + j * secφ * secφ + 2 * (φ - y) * tanφ); } while (Math.abs(δ) > ε && --i > 0); tanφ = Math.tan(φ); return [ (Math.abs(y) < Math.abs(φ + 1 / tanφ) ? asin(x * tanφ) : sgn(x) * (acos(Math.abs(x * tanφ)) + π / 2)) / Math.sin(φ), φ ]; }; (d3.geo.polyconic = function() { return projection(polyconic); }).raw = polyconic;
Version data entries
4 entries across 4 versions & 1 rubygems