Sha256: 00dd7bd2e15ced0121040a08382fd6b9ce4f4fae88a4566093552acc9bc10351

Contents?: true

Size: 497 Bytes

Versions: 4

Compression:

Stored size: 497 Bytes

Contents

import "projection";

function nellHammer(λ, φ) {
  return [
    λ * (1 + Math.cos(φ)) / 2,
    2 * (φ - Math.tan(φ / 2))
  ];
}

nellHammer.invert = function(x, y) {
  var p = y / 2;
  for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) {
    var c = Math.cos(y / 2);
    y -= δ = (y - Math.tan(y / 2) - p) / (1 - .5 / (c * c));
  }
  return [
    2 * x / (1 + Math.cos(y)),
    y
  ];
};

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
d3js-plugins-rails-0.0.8 vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js
d3js-plugins-rails-0.0.7 vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js
d3js-plugins-rails-0.0.6 vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js
d3js-plugins-rails-0.0.5 vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js