Sha256: 4bfc3c3882c92cf5665b3dae4b46ecf7fc3d65f59d08249c9898debcf6ed25b2

Contents?: true

Size: 830 Bytes

Versions: 4

Compression:

Stored size: 830 Bytes

Contents

function mollweideBromleyθ(Cp) {
  return function(θ) {
    var Cpsinθ = Cp * Math.sin(θ),
        i = 30, δ;
    do θ -= δ = (θ + Math.sin(θ) - Cpsinθ) / (1 + Math.cos(θ));
    while (Math.abs(δ) > ε && --i > 0);
    return θ / 2;
  };
}

function mollweideBromley(Cx, Cy, Cp) {
  var θ = mollweideBromleyθ(Cp);

  function forward(λ, φ) {
    return [
      Cx * λ * Math.cos(φ = θ(φ)),
      Cy * Math.sin(φ)
    ];
  }

  forward.invert = function(x, y) {
    var θ = asin(y / Cy);
    return [
      x / (Cx * Math.cos(θ)),
      asin((2 * θ + Math.sin(2 * θ)) / Cp)
    ];
  };

  return forward;
}

var mollweideθ = mollweideBromleyθ(π),
    mollweide = mollweideBromley(2 * Math.SQRT2 / π, Math.SQRT2, π);

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

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/mollweide.js
d3js-plugins-rails-0.0.3 vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js
d3js-plugins-rails-0.0.2 vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js
d3js-plugins-rails-0.0.1 vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js