Sha256: 71eb08252c49e3905129da31257f0e0be01a62e78def13b8a69f052371a3f543

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

function wiechel(λ, φ) {
  var cosφ = Math.cos(φ),
      sinφ = Math.cos(λ) * cosφ,
      sin1_φ = 1 - sinφ,
      cosλ = Math.cos(λ = Math.atan2(Math.sin(λ) * cosφ, -Math.sin(φ))),
      sinλ = Math.sin(λ);
  cosφ = asqrt(1 - sinφ * sinφ);
  return [
    sinλ * cosφ - cosλ * sin1_φ,
    -cosλ * cosφ - sinλ * sin1_φ
  ];
}

wiechel.invert = function(x, y) {
  var w = -.5 * (x * x + y * y),
      k = Math.sqrt(-w * (2 + w)),
      b = y * w + x * k,
      a = x * w - y * k,
      D = Math.sqrt(a * a + b * b);
  return [
    Math.atan2(k * b, D * (1 + w)),
    D ? -asin(k * a / D) : 0
  ];
};

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
d3js-plugins-rails-0.0.4 vendor/assets/javascripts/d3/plugins/geo/projection/wiechel.js
d3js-plugins-rails-0.0.3 vendor/assets/javascripts/d3/plugins/geo/projection/wiechel.js