d3js-plugins-rails 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/lib/d3js-plugins-rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/d3/plugins/LICENSE +1 -1
  5. data/vendor/assets/javascripts/d3/plugins/README.md +0 -14
  6. data/vendor/assets/javascripts/d3/plugins/geo/projection/README.md +1 -252
  7. data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/README.md +9 -0
  8. data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/interpolate-zoom-test.js +27 -0
  9. data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/interpolate-zoom.js +18 -32
  10. data.tar.gz.sig +0 -0
  11. metadata +4 -140
  12. metadata.gz.sig +2 -5
  13. data/vendor/assets/javascripts/d3/plugins/.gitignore +0 -1
  14. data/vendor/assets/javascripts/d3/plugins/Makefile +0 -18
  15. data/vendor/assets/javascripts/d3/plugins/geo/projection/airy.js +0 -55
  16. data/vendor/assets/javascripts/d3/plugins/geo/projection/aitoff.js +0 -42
  17. data/vendor/assets/javascripts/d3/plugins/geo/projection/armadillo.js +0 -81
  18. data/vendor/assets/javascripts/d3/plugins/geo/projection/august.js +0 -36
  19. data/vendor/assets/javascripts/d3/plugins/geo/projection/baker.js +0 -30
  20. data/vendor/assets/javascripts/d3/plugins/geo/projection/berghaus.js +0 -76
  21. data/vendor/assets/javascripts/d3/plugins/geo/projection/boggs.js +0 -28
  22. data/vendor/assets/javascripts/d3/plugins/geo/projection/bonne.js +0 -30
  23. data/vendor/assets/javascripts/d3/plugins/geo/projection/bromley.js +0 -6
  24. data/vendor/assets/javascripts/d3/plugins/geo/projection/chamberlin.js +0 -116
  25. data/vendor/assets/javascripts/d3/plugins/geo/projection/collignon.js +0 -19
  26. data/vendor/assets/javascripts/d3/plugins/geo/projection/craig.js +0 -31
  27. data/vendor/assets/javascripts/d3/plugins/geo/projection/craster.js +0 -20
  28. data/vendor/assets/javascripts/d3/plugins/geo/projection/cylindrical-equal-area.js +0 -24
  29. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert1.js +0 -20
  30. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert2.js +0 -19
  31. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert3.js +0 -19
  32. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert4.js +0 -26
  33. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert5.js +0 -19
  34. data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert6.js +0 -24
  35. data/vendor/assets/javascripts/d3/plugins/geo/projection/eisenlohr.js +0 -78
  36. data/vendor/assets/javascripts/d3/plugins/geo/projection/elliptic.js +0 -118
  37. data/vendor/assets/javascripts/d3/plugins/geo/projection/end.js +0 -1
  38. data/vendor/assets/javascripts/d3/plugins/geo/projection/fahey.js +0 -21
  39. data/vendor/assets/javascripts/d3/plugins/geo/projection/gall-stereographic.js +0 -19
  40. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg-polyconic.js +0 -56
  41. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg4.js +0 -6
  42. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg5.js +0 -6
  43. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg6.js +0 -6
  44. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg8.js +0 -29
  45. data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg9.js +0 -6
  46. data/vendor/assets/javascripts/d3/plugins/geo/projection/gringorten.js +0 -150
  47. data/vendor/assets/javascripts/d3/plugins/geo/projection/guyou.js +0 -55
  48. data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer-retroazimuthal.js +0 -106
  49. data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer.js +0 -53
  50. data/vendor/assets/javascripts/d3/plugins/geo/projection/hatano.js +0 -27
  51. data/vendor/assets/javascripts/d3/plugins/geo/projection/healpix.js +0 -85
  52. data/vendor/assets/javascripts/d3/plugins/geo/projection/hill.js +0 -66
  53. data/vendor/assets/javascripts/d3/plugins/geo/projection/homolosine.js +0 -18
  54. data/vendor/assets/javascripts/d3/plugins/geo/projection/hyperbolic.js +0 -22
  55. data/vendor/assets/javascripts/d3/plugins/geo/projection/index.js +0 -72
  56. data/vendor/assets/javascripts/d3/plugins/geo/projection/interrupt.js +0 -150
  57. data/vendor/assets/javascripts/d3/plugins/geo/projection/kavrayskiy7.js +0 -17
  58. data/vendor/assets/javascripts/d3/plugins/geo/projection/lagrange.js +0 -47
  59. data/vendor/assets/javascripts/d3/plugins/geo/projection/larrivee.js +0 -41
  60. data/vendor/assets/javascripts/d3/plugins/geo/projection/laskowski.js +0 -33
  61. data/vendor/assets/javascripts/d3/plugins/geo/projection/littrow.js +0 -23
  62. data/vendor/assets/javascripts/d3/plugins/geo/projection/loximuthal.js +0 -30
  63. data/vendor/assets/javascripts/d3/plugins/geo/projection/math.js +0 -26
  64. data/vendor/assets/javascripts/d3/plugins/geo/projection/miller.js +0 -17
  65. data/vendor/assets/javascripts/d3/plugins/geo/projection/modified-stereographic.js +0 -106
  66. data/vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js +0 -37
  67. data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-parabolic.js +0 -23
  68. data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js +0 -25
  69. data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-sinusoidal.js +0 -27
  70. data/vendor/assets/javascripts/d3/plugins/geo/projection/natural-earth.js +0 -24
  71. data/vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js +0 -22
  72. data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel1.js +0 -14
  73. data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel2.js +0 -15
  74. data/vendor/assets/javascripts/d3/plugins/geo/projection/peirce-quincuncial.js +0 -7
  75. data/vendor/assets/javascripts/d3/plugins/geo/projection/polyconic.js +0 -31
  76. data/vendor/assets/javascripts/d3/plugins/geo/projection/projection.js +0 -4
  77. data/vendor/assets/javascripts/d3/plugins/geo/projection/quincuncial.js +0 -73
  78. data/vendor/assets/javascripts/d3/plugins/geo/projection/rectangular-polyconic.js +0 -41
  79. data/vendor/assets/javascripts/d3/plugins/geo/projection/robinson.js +0 -85
  80. data/vendor/assets/javascripts/d3/plugins/geo/projection/satellite.js +0 -70
  81. data/vendor/assets/javascripts/d3/plugins/geo/projection/sinu-mollweide.js +0 -20
  82. data/vendor/assets/javascripts/d3/plugins/geo/projection/sinusoidal.js +0 -17
  83. data/vendor/assets/javascripts/d3/plugins/geo/projection/start.js +0 -1
  84. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/airy-test.js +0 -25
  85. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/aitoff-test.js +0 -28
  86. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/armadillo-test.js +0 -30
  87. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/assert.js +0 -32
  88. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/august-test.js +0 -29
  89. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/baker-test.js +0 -28
  90. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/berghaus-test.js +0 -28
  91. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/boggs-test.js +0 -28
  92. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/bonne-test.js +0 -45
  93. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craig-test.js +0 -40
  94. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craster-test.js +0 -27
  95. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/eckert4-test.js +0 -26
  96. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/eisenlohr-test.js +0 -36
  97. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/equirectangular-test.js +0 -96
  98. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/fahey-test.js +0 -27
  99. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg4-test.js +0 -28
  100. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg5-test.js +0 -28
  101. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg6-test.js +0 -28
  102. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg8-test.js +0 -28
  103. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg9-test.js +0 -28
  104. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/gringorten-test.js +0 -26
  105. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/guyou-test.js +0 -28
  106. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hammer-retroazimuthal-test.js +0 -39
  107. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hammer-test.js +0 -29
  108. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hatano-test.js +0 -27
  109. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/healpix-test.js +0 -26
  110. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hill-test.js +0 -28
  111. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/lagrange-test.js +0 -59
  112. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/larrivee-test.js +0 -27
  113. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/laskowski-test.js +0 -28
  114. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/littrow-test.js +0 -26
  115. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/load.js +0 -20
  116. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/loximuthal-test.js +0 -27
  117. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/modified-stereographic-test.js +0 -26
  118. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mollweide-test.js +0 -28
  119. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-parabolic-test.js +0 -27
  120. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-quartic-test.js +0 -27
  121. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-sinusoidal-test.js +0 -27
  122. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/natural-earth-test.js +0 -28
  123. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/peirce-quincuncial-test.js +0 -26
  124. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/polyconic-test.js +0 -28
  125. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/quartic-authalic-test.js +0 -0
  126. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/rectangular-polyconic-test.js +0 -48
  127. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/robinson-test.js +0 -28
  128. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/times-test.js +0 -26
  129. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/two-point-azimuthal-test.js +0 -24
  130. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/two-point-equidistant-test.js +0 -26
  131. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten2-test.js +0 -26
  132. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten3-test.js +0 -26
  133. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten4-test.js +0 -32
  134. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/wagner6-test.js +0 -27
  135. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/wiechel-test.js +0 -26
  136. data/vendor/assets/javascripts/d3/plugins/geo/projection/test/winkel3-test.js +0 -28
  137. data/vendor/assets/javascripts/d3/plugins/geo/projection/times.js +0 -21
  138. data/vendor/assets/javascripts/d3/plugins/geo/projection/two-point-azimuthal.js +0 -47
  139. data/vendor/assets/javascripts/d3/plugins/geo/projection/two-point-equidistant.js +0 -83
  140. data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten.js +0 -43
  141. data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten2.js +0 -30
  142. data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten3.js +0 -26
  143. data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten4.js +0 -56
  144. data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner4.js +0 -10
  145. data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner6.js +0 -17
  146. data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner7.js +0 -24
  147. data/vendor/assets/javascripts/d3/plugins/geo/projection/wiechel.js +0 -28
  148. data/vendor/assets/javascripts/d3/plugins/geo/projection/winkel3.js +0 -41
  149. data/vendor/assets/javascripts/d3/plugins/package.json +0 -22
@@ -1,15 +0,0 @@
1
- import "projection";
2
-
3
- function parallel2Projection(projectAt) {
4
- var φ0 = 0,
5
- φ1 = π / 3,
6
- m = projectionMutator(projectAt),
7
- p = m(φ0, φ1);
8
-
9
- p.parallels = function(_) {
10
- if (!arguments.length) return [φ0 / π * 180, φ1 / π * 180];
11
- return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
12
- };
13
-
14
- return p;
15
- }
@@ -1,7 +0,0 @@
1
- import "projection";
2
- import "guyou";
3
- import "quincuncial";
4
-
5
- var peirceQuincuncialProjection = quincuncialProjection(guyou);
6
-
7
- (d3.geo.peirceQuincuncial = function() { return peirceQuincuncialProjection().quincuncial(true).rotate([-90, -90, 45]).clipAngle(180 - 1e-6); }).raw = peirceQuincuncialProjection.raw;
@@ -1,31 +0,0 @@
1
- import "projection";
2
-
3
- function polyconic(λ, φ) {
4
- if (Math.abs(φ) < ε) return [λ, 0];
5
- var tanφ = Math.tan(φ),
6
- k = λ * Math.sin(φ);
7
- return [
8
- Math.sin(k) / tanφ,
9
- φ + (1 - Math.cos(k)) / tanφ
10
- ];
11
- }
12
-
13
- polyconic.invert = function(x, y) {
14
- if (Math.abs(y) < ε) return [x, 0];
15
- var k = x * x + y * y,
16
- φ = y * .5,
17
- i = 10, δ;
18
- do {
19
- var tanφ = Math.tan(φ),
20
- secφ = 1 / Math.cos(φ),
21
- j = k - 2 * y * φ + φ * φ;
22
- φ -= δ = (tanφ * j + 2 * (φ - y)) / (2 + j * secφ * secφ + 2 * (φ - y) * tanφ);
23
- } while (Math.abs(δ) > ε && --i > 0);
24
- tanφ = Math.tan(φ);
25
- return [
26
- (Math.abs(y) < Math.abs(φ + 1 / tanφ) ? asin(x * tanφ) : sgn(x) * (acos(Math.abs(x * tanφ)) + π / 2)) / Math.sin(φ),
27
- φ
28
- ];
29
- };
30
-
31
- (d3.geo.polyconic = function() { return projection(polyconic); }).raw = polyconic;
@@ -1,4 +0,0 @@
1
- import "math";
2
-
3
- var projection = d3.geo.projection,
4
- projectionMutator = d3.geo.projectionMutator;
@@ -1,73 +0,0 @@
1
- import "projection";
2
-
3
- function quincuncialProjection(projectHemisphere) {
4
- var dx = projectHemisphere(π / 2, 0)[0] - projectHemisphere(-π / 2, 0)[0];
5
-
6
- function projection() {
7
- var quincuncial = false,
8
- m = projectionMutator(projectAt),
9
- p = m(quincuncial);
10
-
11
- p.quincuncial = function(_) {
12
- if (!arguments.length) return quincuncial;
13
- return m(quincuncial = !!_);
14
- };
15
-
16
- return p;
17
- }
18
-
19
- function projectAt(quincuncial) {
20
- var forward = quincuncial ? function(λ, φ) {
21
- var t = Math.abs(λ) < π / 2,
22
- p = projectHemisphere(t ? λ : λ > 0 ? λ - π : λ + π, φ);
23
-
24
- var x = (p[0] - p[1]) * Math.SQRT1_2,
25
- y = (p[0] + p[1]) * Math.SQRT1_2;
26
-
27
- if (t) return [x, y];
28
-
29
- var d = dx * Math.SQRT1_2,
30
- s = x > 0 ^ y > 0 ? -1 : 1;
31
-
32
- return [s * x - sgn(y) * d, s * y - sgn(x) * d];
33
- } : function(λ, φ) {
34
- var s = λ > 0 ? -.5 : .5,
35
- point = projectHemisphere(λ + s * π, φ);
36
- point[0] -= s * dx;
37
- return point;
38
- };
39
-
40
- if (projectHemisphere.invert) forward.invert = quincuncial ? function(x0, y0) {
41
- var x = (x0 + y0) * Math.SQRT1_2,
42
- y = (y0 - x0) * Math.SQRT1_2,
43
- t = Math.abs(x) < .5 * dx && Math.abs(y) < .5 * dx;
44
-
45
- if (!t) {
46
- var d = dx * Math.SQRT1_2,
47
- s = x > 0 ^ y > 0 ? -1 : 1,
48
- x1 = -s * (x0 + (y > 0 ? 1 : -1) * d),
49
- y1 = -s * (y0 + (x > 0 ? 1 : -1) * d);
50
- x = (-x1 - y1) * Math.SQRT1_2;
51
- y = (x1 - y1) * Math.SQRT1_2;
52
- }
53
-
54
- var p = projectHemisphere.invert(x, y);
55
- if (!t) p[0] += x > 0 ? π : -π;
56
- return p;
57
- } : function(x, y) {
58
- var s = x > 0 ? -.5 : .5,
59
- location = projectHemisphere.invert(x + s * dx, y),
60
- λ = location[0] - s * π;
61
- if (λ < -π) λ += 2 * π;
62
- else if (λ > π) λ -= 2 * π;
63
- location[0] = λ;
64
- return location;
65
- };
66
-
67
- return forward;
68
- }
69
-
70
- projection.raw = projectAt;
71
-
72
- return projection;
73
- }
@@ -1,41 +0,0 @@
1
- import "projection";
2
- import "parallel1";
3
-
4
- function rectangularPolyconic(φ0) {
5
- var sinφ0 = Math.sin(φ0);
6
-
7
- function forward(λ, φ) {
8
- var A = sinφ0 ? Math.tan(λ * sinφ0 / 2) / sinφ0 : λ / 2;
9
- if (!φ) return [2 * A, -φ0];
10
- var E = 2 * Math.atan(A * Math.sin(φ)),
11
- cotφ = 1 / Math.tan(φ);
12
- return [
13
- Math.sin(E) * cotφ,
14
- φ + (1 - Math.cos(E)) * cotφ - φ0
15
- ];
16
- }
17
-
18
- // TODO return null for points outside outline.
19
- forward.invert = function(x, y) {
20
- if (Math.abs(y += φ0) < ε) return [sinφ0 ? 2 * Math.atan(sinφ0 * x / 2) / sinφ0 : x, 0];
21
- var k = x * x + y * y,
22
- φ = 0,
23
- i = 10, δ;
24
- do {
25
- var tanφ = Math.tan(φ),
26
- secφ = 1 / Math.cos(φ),
27
- j = k - 2 * y * φ + φ * φ;
28
- φ -= δ = (tanφ * j + 2 * (φ - y)) / (2 + j * secφ * secφ + 2 * (φ - y) * tanφ);
29
- } while (Math.abs(δ) > ε && --i > 0);
30
- var E = x * (tanφ = Math.tan(φ)),
31
- A = Math.tan(Math.abs(y) < Math.abs(φ + 1 / tanφ) ? asin(E) * .5 : acos(E) * .5 + π / 4) / Math.sin(φ);
32
- return [
33
- sinφ0 ? 2 * Math.atan(sinφ0 * A) / sinφ0 : 2 * A,
34
- φ
35
- ];
36
- };
37
-
38
- return forward;
39
- }
40
-
41
- (d3.geo.rectangularPolyconic = function() { return parallel1Projection(rectangularPolyconic); }).raw = rectangularPolyconic;
@@ -1,85 +0,0 @@
1
- import "projection";
2
-
3
- var robinsonConstants = [
4
- [0.9986, -0.062],
5
- [1.0000, 0.0000],
6
- [0.9986, 0.0620],
7
- [0.9954, 0.1240],
8
- [0.9900, 0.1860],
9
- [0.9822, 0.2480],
10
- [0.9730, 0.3100],
11
- [0.9600, 0.3720],
12
- [0.9427, 0.4340],
13
- [0.9216, 0.4958],
14
- [0.8962, 0.5571],
15
- [0.8679, 0.6176],
16
- [0.8350, 0.6769],
17
- [0.7986, 0.7346],
18
- [0.7597, 0.7903],
19
- [0.7186, 0.8435],
20
- [0.6732, 0.8936],
21
- [0.6213, 0.9394],
22
- [0.5722, 0.9761],
23
- [0.5322, 1.0000]
24
- ];
25
-
26
- robinsonConstants.forEach(function(d) {
27
- d[1] *= 1.0144;
28
- });
29
-
30
- function robinson(λ, φ) {
31
- var i = Math.min(18, Math.abs(φ) * 36 / π),
32
- i0 = Math.floor(i),
33
- di = i - i0,
34
- ax = (k = robinsonConstants[i0])[0],
35
- ay = k[1],
36
- bx = (k = robinsonConstants[++i0])[0],
37
- by = k[1],
38
- cx = (k = robinsonConstants[Math.min(19, ++i0)])[0],
39
- cy = k[1],
40
- k;
41
- return [
42
- λ * (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2),
43
- (φ > 0 ? π : -π) / 2 * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2)
44
- ];
45
- }
46
-
47
- robinson.invert = function(x, y) {
48
- var yy = 2 * y / π,
49
- φ = yy * 90,
50
- i = Math.min(18, Math.abs(φ / 5)),
51
- i0 = Math.max(0, Math.floor(i));
52
- do {
53
- var ay = robinsonConstants[i0][1],
54
- by = robinsonConstants[i0 + 1][1],
55
- cy = robinsonConstants[Math.min(19, i0 + 2)][1],
56
- u = cy - ay,
57
- v = cy - 2 * by + ay,
58
- t = 2 * (Math.abs(yy) - by) / u,
59
- c = v / u,
60
- di = t * (1 - c * t * (1 - 2 * c * t));
61
- if (di >= 0 || i0 === 1) {
62
- φ = (y >= 0 ? 5 : -5) * (di + i);
63
- var j = 50, δ;
64
- do {
65
- i = Math.min(18, Math.abs(φ) / 5);
66
- i0 = Math.floor(i);
67
- di = i - i0;
68
- ay = robinsonConstants[i0][1];
69
- by = robinsonConstants[i0 + 1][1];
70
- cy = robinsonConstants[Math.min(19, i0 + 2)][1];
71
- φ -= (δ = (y >= 0 ? π : -π) / 2 * (by + di * (cy - ay) / 2 + di * di * (cy - 2 * by + ay) / 2) - y) * degrees;
72
- } while (Math.abs(δ) > ε2 && --j > 0);
73
- break;
74
- }
75
- } while (--i0 >= 0);
76
- var ax = robinsonConstants[i0][0],
77
- bx = robinsonConstants[i0 + 1][0],
78
- cx = robinsonConstants[Math.min(19, i0 + 2)][0];
79
- return [
80
- x / (bx + di * (cx - ax) / 2 + di * di * (cx - 2 * bx + ax) / 2),
81
- φ * radians
82
- ];
83
- };
84
-
85
- (d3.geo.robinson = function() { return projection(robinson); }).raw = robinson;
@@ -1,70 +0,0 @@
1
- import "projection";
2
-
3
- function satelliteVertical(P) {
4
- function forward(λ, φ) {
5
- var cosφ = Math.cos(φ),
6
- k = (P - 1) / (P - cosφ * Math.cos(λ));
7
- return [
8
- k * cosφ * Math.sin(λ),
9
- k * Math.sin(φ)
10
- ];
11
- }
12
-
13
- forward.invert = function(x, y) {
14
- var ρ2 = x * x + y * y,
15
- ρ = Math.sqrt(ρ2),
16
- sinc = (P - Math.sqrt(1 - ρ2 * (P + 1) / (P - 1))) / ((P - 1) / ρ + ρ / (P - 1));
17
- return [
18
- Math.atan2(x * sinc, ρ * Math.sqrt(1 - sinc * sinc)),
19
- ρ ? asin(y * sinc / ρ) : 0
20
- ];
21
- };
22
-
23
- return forward;
24
- }
25
-
26
- function satellite(P, ω) {
27
- var vertical = satelliteVertical(P);
28
- if (!ω) return vertical;
29
- var cosω = Math.cos(ω),
30
- sinω = Math.sin(ω);
31
-
32
- function forward(λ, φ) {
33
- var coordinates = vertical(λ, φ),
34
- y = coordinates[1],
35
- A = y * sinω / (P - 1) + cosω;
36
- return [
37
- coordinates[0] * cosω / A,
38
- y / A
39
- ];
40
- }
41
-
42
- forward.invert = function(x, y) {
43
- var k = (P - 1) / (P - 1 - y * sinω);
44
- return vertical.invert(k * x, k * y * cosω);
45
- };
46
-
47
- return forward;
48
- }
49
-
50
- function satelliteProjection() {
51
- var P = 1.4,
52
- ω = 0,
53
- m = projectionMutator(satellite),
54
- p = m(P, ω);
55
-
56
- // As a multiple of radius.
57
- p.distance = function(_) {
58
- if (!arguments.length) return P;
59
- return m(P = +_, ω);
60
- };
61
-
62
- p.tilt = function(_) {
63
- if (!arguments.length) return ω * 180 / π;
64
- return m(P, ω = _ * π / 180);
65
- };
66
-
67
- return p;
68
- }
69
-
70
- (d3.geo.satellite = satelliteProjection).raw = satellite;
@@ -1,20 +0,0 @@
1
- import "projection";
2
- import "mollweide";
3
- import "sinusoidal";
4
-
5
- var sinuMollweideφ = .7109889596207567,
6
- sinuMollweideY = .0528035274542;
7
-
8
- function sinuMollweide(λ, φ) {
9
- return φ > -sinuMollweideφ
10
- ? (λ = mollweide(λ, φ), λ[1] += sinuMollweideY, λ)
11
- : sinusoidal(λ, φ);
12
- }
13
-
14
- sinuMollweide.invert = function(x, y) {
15
- return y > -sinuMollweideφ
16
- ? mollweide.invert(x, y - sinuMollweideY)
17
- : sinusoidal.invert(x, y);
18
- };
19
-
20
- (d3.geo.sinuMollweide = function() { return projection(sinuMollweide).rotate([-20, -55]); }).raw = sinuMollweide;
@@ -1,17 +0,0 @@
1
- import "projection";
2
-
3
- function sinusoidal(λ, φ) {
4
- return [
5
- λ * Math.cos(φ),
6
- φ
7
- ];
8
- }
9
-
10
- sinusoidal.invert = function(x, y) {
11
- return [
12
- x / Math.cos(y),
13
- y
14
- ];
15
- };
16
-
17
- (d3.geo.sinusoidal = function() { return projection(sinusoidal); }).raw = sinusoidal;
@@ -1 +0,0 @@
1
- (function() {
@@ -1,25 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.airy");
6
-
7
- suite.addBatch({
8
- "airy": {
9
- topic: load("airy"),
10
- "default": {
11
- topic: function(geo) { return geo.airy(); },
12
- "projections and inverse projections": function(airy) {
13
- assert.equalInverse(airy, [ 0, 0], [480, 250]);
14
- assert.equalInverse(airy, [ 180, -90], [480, 457.944154]);
15
- assert.equalInverse(airy, [ 180, 90], [480, 42.055845]);
16
- assert.equalInverse(airy, [ 0, -45], [480, 350.409232]);
17
- assert.equalInverse(airy, [ 0, 45], [480, 149.590767]);
18
- assert.equalInverse(airy, [ 1, 1], [482.216112, 247.783550]);
19
- assert.equalInverse(airy, [ 45, 87], [487.496494, 47.708572]);
20
- }
21
- }
22
- }
23
- });
24
-
25
- suite.export(module);
@@ -1,28 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.aitoff");
6
-
7
- suite.addBatch({
8
- "aitoff": {
9
- topic: load("aitoff"),
10
- "default": {
11
- topic: function(geo) { return geo.aitoff(); },
12
- "projections and inverse projections": function(aitoff) {
13
- assert.equalInverse(aitoff, [ 0, 0], [480, 250]);
14
- assert.equalInverse(aitoff, [ 0, -90], [480, 485.619449]);
15
- assert.equalInverse(aitoff, [ 0, 90], [480, 14.380550]);
16
- assert.equalInverse(aitoff, [ 0, -45], [480, 367.809724]);
17
- assert.equalInverse(aitoff, [ 0, 45], [480, 132.190275]);
18
- assert.equalInverse(aitoff, [-180, 0], [ 8.761101, 250]);
19
- assert.equalInverse(aitoff, [ 180, 0], [951.238898, 250]);
20
- assert.equalInverse(aitoff, [-179, 15], [ 27.261952, 189.342293]);
21
- assert.equalInverse(aitoff, [ 1, 1], [482.617728, 247.381972]);
22
- assert.equalInverse(aitoff, [ 45, 87], [489.158099, 21.6821110]);
23
- }
24
- }
25
- }
26
- });
27
-
28
- suite.export(module);
@@ -1,30 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.armadillo");
6
-
7
- suite.addBatch({
8
- "armadillo": {
9
- topic: load("armadillo"),
10
- "default": {
11
- topic: function(geo) { return geo.armadillo(); },
12
- "projections and inverse projections": function(armadillo) {
13
- assert.equalInverse(armadillo, [ 0, 0], [480, 250]);
14
- // TODO: needs D3 core support
15
- // assert.isNaN(armadillo([0, -90])[0]);
16
- assert.equalInverse(armadillo, [ 0, 90], [480, 57.743085]);
17
- assert.equalInverse(armadillo, [ 0, -45], [480, 334.643146]);
18
- assert.equalInverse(armadillo, [ 0, 45], [480, 135.304239]);
19
- // TODO figure out why the inverse doesn't match exactly.
20
- // assert.equalInverse(armadillo, [-180, 0], [180, 147.393957]);
21
- // assert.equalInverse(armadillo, [ 180, 0], [780, 147.393957]);
22
- assert.equalInverse(armadillo, [-179, 15], [185.122354, 111.792545]);
23
- assert.equalInverse(armadillo, [ 1, 1], [482.617761, 247.528295]);
24
- assert.equalInverse(armadillo, [ 45, 87], [540.406730, 56.511657]);
25
- }
26
- }
27
- }
28
- });
29
-
30
- suite.export(module);
@@ -1,32 +0,0 @@
1
- var assert = require("assert");
2
-
3
- assert = module.exports = Object.create(assert);
4
-
5
- assert.inDelta = function(actual, expected, delta, message) {
6
- if (!inDelta(actual, expected, delta)) {
7
- assert.fail(actual, expected, message || "expected {actual} to be in within *" + delta + "* of {expected}", null, assert.inDelta);
8
- }
9
- };
10
-
11
- assert.equalInverse = function(projection, location, point, delta) {
12
- delta = delta || 1e-6;
13
- var projected;
14
- assert.inDelta(projected = projection(location), point, delta);
15
- assert.inDelta(projection.invert(projected), location, delta);
16
- assert.inDelta(projection(projection.invert(point)), point, delta);
17
- };
18
-
19
- function inDelta(actual, expected, delta) {
20
- return (Array.isArray(expected) ? inDeltaArray : inDeltaNumber)(actual, expected, delta);
21
- }
22
-
23
- function inDeltaArray(actual, expected, delta) {
24
- var n = expected.length, i = -1;
25
- if (actual.length !== n) return false;
26
- while (++i < n) if (!inDelta(actual[i], expected[i], delta)) return false;
27
- return true;
28
- }
29
-
30
- function inDeltaNumber(actual, expected, delta) {
31
- return actual >= expected - delta && actual <= expected + delta;
32
- }
@@ -1,29 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.august");
6
-
7
- suite.addBatch({
8
- "august": {
9
- topic: load("august"),
10
- "default": {
11
- topic: function(geo) { return geo.august(); },
12
- "projections and inverse projections": function(august) {
13
- assert.equalInverse(august, [ 0, 0], [480, 250]);
14
- assert.equalInverse(august, [ 0, -45], [480, 378.067905]);
15
- assert.equalInverse(august, [ 0, 45], [480, 121.932094]);
16
- assert.equalInverse(august, [ 0, 90], [480, -150]);
17
- assert.equalInverse(august, [ 0, 80], [480, -43.976545]);
18
- assert.equalInverse(august, [-90, 0], [217.258300, 250]);
19
- assert.equalInverse(august, [ 90, 0], [742.741699, 250]);
20
- assert.equalInverse(august, [-80, 15], [254.414080, 199.297313]);
21
- assert.equalInverse(august, [ 1, 1], [482.617927, 247.381806]);
22
- assert.equalInverse(august, [ 15, 80], [499.471722, -45.366200]);
23
- assert.equalInverse(august, [100, 50], [732.424769, 43.602745]);
24
- }
25
- }
26
- }
27
- });
28
-
29
- suite.export(module);
@@ -1,28 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.baker");
6
-
7
- suite.addBatch({
8
- "baker": {
9
- topic: load("baker"),
10
- "default": {
11
- topic: function(geo) { return geo.baker(); },
12
- "projections and inverse projections": function(baker) {
13
- assert.equalInverse(baker, [ 0, 0], [480, 250]);
14
- assert.equalInverse(baker, [ 0, -90], [480, 583.216220]);
15
- assert.equalInverse(baker, [ 0, 90], [480, -83.216220]);
16
- assert.equalInverse(baker, [ 0, -45], [480, 382.206038]);
17
- assert.equalInverse(baker, [ 0, 45], [480, 117.793961]);
18
- assert.equalInverse(baker, [-180, 0], [ 8.761101, 250]);
19
- assert.equalInverse(baker, [ 180, 0], [951.238898, 250]);
20
- assert.equalInverse(baker, [-179, 15], [ 11.379095, 210.273662]);
21
- assert.equalInverse(baker, [ 1, 1], [482.617993, 247.381873]);
22
- assert.equalInverse(baker, [ 45, 87], [491.265043, -68.859378]);
23
- }
24
- }
25
- }
26
- });
27
-
28
- suite.export(module);
@@ -1,28 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.berghaus");
6
-
7
- suite.addBatch({
8
- "berghaus": {
9
- topic: load("berghaus"),
10
- "default": {
11
- topic: function(geo) { return geo.berghaus(); },
12
- "projections and inverse projections": function(berghaus) {
13
- assert.equalInverse(berghaus, [ 0, 0], [480, 250]);
14
- assert.equalInverse(berghaus, [ 0, -45], [480, 367.809724]);
15
- assert.equalInverse(berghaus, [ 0, 45], [480, 132.190275]);
16
- assert.equalInverse(berghaus, [-90, 0], [244.380550, 250]);
17
- assert.equalInverse(berghaus, [ 90, 0], [715.619449, 250]);
18
- assert.equalInverse(berghaus, [-80, 15], [277.038148, 194.777583]);
19
- assert.equalInverse(berghaus, [ 1, 1], [482.617728, 247.381873]);
20
- assert.equalInverse(berghaus, [ 15, 45], [510.778518, 131.080938]);
21
- assert.equalInverse(berghaus, [120, 30], [750.967904, 114.867516]);
22
- assert.equalInverse(berghaus, [110, 10], [759.454234, 183.963114]);
23
- }
24
- }
25
- }
26
- });
27
-
28
- suite.export(module);
@@ -1,28 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.boggs");
6
-
7
- suite.addBatch({
8
- "boggs": {
9
- topic: load("boggs"),
10
- "default": {
11
- topic: function(geo) { return geo.boggs(); },
12
- "projections and inverse projections": function(boggs) {
13
- assert.equalInverse(boggs, [ 0, 0], [480, 250]);
14
- assert.equalInverse(boggs, [ 0, -90], [480, 473.567218]);
15
- assert.equalInverse(boggs, [ 0, 90], [480, 26.432781]);
16
- assert.equalInverse(boggs, [ 0, -45], [480, 371.532657]);
17
- assert.equalInverse(boggs, [ 0, 45], [480, 128.467342]);
18
- assert.equalInverse(boggs, [-180, 0], [ 32.864228, 250]);
19
- assert.equalInverse(boggs, [ 180, 0], [927.135771, 250]);
20
- assert.equalInverse(boggs, [-179, 15], [ 47.500957, 208.708722]);
21
- assert.equalInverse(boggs, [ 1, 1], [482.483785, 247.240908]);
22
- assert.equalInverse(boggs, [ 45, 87], [488.857270, 31.512628]);
23
- }
24
- }
25
- }
26
- });
27
-
28
- suite.export(module);
@@ -1,45 +0,0 @@
1
- var vows = require("vows"),
2
- assert = require("./assert"),
3
- load = require("./load");
4
-
5
- var suite = vows.describe("d3.geo.bonne");
6
-
7
- suite.addBatch({
8
- "bonne": {
9
- topic: load("bonne"),
10
- "40° parallel": {
11
- topic: function(geo) {
12
- return geo.bonne().parallel(40);
13
- },
14
- "projections and inverse projections": function(bonne) {
15
- assert.equalInverse(bonne, [ 0, 0], [480, 250]);
16
- assert.equalInverse(bonne, [ 0, -90], [480, 485.619449]);
17
- assert.equalInverse(bonne, [ 0, 90], [480, 14.380550]);
18
- assert.equalInverse(bonne, [ 0, -45], [480, 367.809724]);
19
- assert.equalInverse(bonne, [ 0, 45], [480, 132.190275]);
20
- assert.equalInverse(bonne, [-180, 0], [197.703665, -59.391754]);
21
- assert.equalInverse(bonne, [ 180, 0], [762.296334, -59.391754]);
22
- assert.equalInverse(bonne, [-179, 15], [245.482446, -101.610988]);
23
- assert.equalInverse(bonne, [ 1, 1], [482.617557, 247.369808]);
24
- }
25
- },
26
- "90° parallel (Werner)": {
27
- topic: function(geo) {
28
- return geo.bonne().parallel(90);
29
- },
30
- "projections and inverse projections": function(bonne) {
31
- assert.equalInverse(bonne, [0, 0], [480, 250]);
32
- }
33
- },
34
- "0° parallel (sinusoidal)": {
35
- topic: function(geo) {
36
- return geo.bonne().parallel(0);
37
- },
38
- "projections and inverse projections": function(bonne) {
39
- assert.equalInverse(bonne, [0, 0], [480, 250]);
40
- }
41
- }
42
- }
43
- });
44
-
45
- suite.export(module);