Sha256: fb4bd780d5a1d2ddbd3306ec239fdffce628cbe7f6920d4de1a7488992bbc02e

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

function mtFlatPolarQuartic(λ, φ) {
  var k = (1 + Math.SQRT1_2) * Math.sin(φ),
      θ = φ;
  for (var i = 0, δ; i < 25; i++) {
    θ -= δ = (Math.sin(θ / 2) + Math.sin(θ) - k) / (.5 * Math.cos(θ / 2) + Math.cos(θ));
    if (Math.abs(δ) < ε) break;
  }
  return [
    λ * (1 + 2 * Math.cos(θ) / Math.cos(θ / 2)) / (3 * Math.SQRT2),
    2 * Math.sqrt(3) * Math.sin(θ / 2) / Math.sqrt(2 + Math.SQRT2)
  ];
}

mtFlatPolarQuartic.invert = function(x, y) {
  var sinθ_2 = y * Math.sqrt(2 + Math.SQRT2) / (2 * Math.sqrt(3)),
      θ = 2 * asin(sinθ_2);
  return [
    3 * Math.SQRT2 * x / (1 + 2 * Math.cos(θ) / Math.cos(θ / 2)),
    asin((sinθ_2 + Math.sin(θ)) / (1 + Math.SQRT1_2))
  ];
};

(d3.geo.mtFlatPolarQuartic = function() { return projection(mtFlatPolarQuartic); }).raw = mtFlatPolarQuartic;

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
d3js-plugins-rails-0.0.4 vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js
d3js-plugins-rails-0.0.3 vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js
d3js-plugins-rails-0.0.2 vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js
d3js-plugins-rails-0.0.1 vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js