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,150 +0,0 @@
1
- import "projection";
2
- import "math";
3
-
4
- d3.geo.interrupt = function(project) {
5
- var lobes = [
6
- [[[-π, 0], [0, π / 2], [π, 0]]],
7
- [[[-π, 0], [0, -π / 2], [π, 0]]]
8
- ];
9
-
10
- var bounds;
11
-
12
- function forward(λ, φ) {
13
- var sign = φ < 0 ? -1 : +1,
14
- hemilobes = lobes[+(φ < 0)];
15
- for (var i = 0, n = hemilobes.length - 1; i < n && λ > hemilobes[i][2][0]; ++i);
16
- var coordinates = project(λ - hemilobes[i][1][0], φ);
17
- coordinates[0] += project(hemilobes[i][1][0], sign * φ > sign * hemilobes[i][0][1] ? hemilobes[i][0][1] : φ)[0];
18
- return coordinates;
19
- }
20
-
21
- function reset() {
22
- bounds = lobes.map(function(hemilobes) {
23
- return hemilobes.map(function(lobe) {
24
- var x0 = project(lobe[0][0], lobe[0][1])[0],
25
- x1 = project(lobe[2][0], lobe[2][1])[0],
26
- y0 = project(lobe[1][0], lobe[0][1])[1],
27
- y1 = project(lobe[1][0], lobe[1][1])[1],
28
- t;
29
- if (y0 > y1) t = y0, y0 = y1, y1 = t;
30
- return [[x0, y0], [x1, y1]];
31
- });
32
- });
33
- }
34
-
35
- // Assumes mutually exclusive bounding boxes for lobes.
36
- if (project.invert) forward.invert = function(x, y) {
37
- var hemibounds = bounds[+(y < 0)],
38
- hemilobes = lobes[+(y < 0)];
39
- for (var i = 0, n = hemibounds.length; i < n; ++i) {
40
- var b = hemibounds[i];
41
- if (b[0][0] <= x && x < b[1][0] && b[0][1] <= y && y < b[1][1]) {
42
- var coordinates = project.invert(x - project(hemilobes[i][1][0], 0)[0], y);
43
- coordinates[0] += hemilobes[i][1][0];
44
- return pointEqual(forward(coordinates[0], coordinates[1]), [x, y]) ? coordinates : null;
45
- }
46
- }
47
- };
48
-
49
- var projection = d3.geo.projection(forward),
50
- stream_ = projection.stream;
51
-
52
- projection.stream = function(stream) {
53
- var rotate = projection.rotate(),
54
- rotateStream = stream_(stream),
55
- sphereStream = (projection.rotate([0, 0]), stream_(stream));
56
- projection.rotate(rotate);
57
- rotateStream.sphere = function() { d3.geo.stream(sphere(), sphereStream); };
58
- return rotateStream;
59
- };
60
-
61
- projection.lobes = function(_) {
62
- if (!arguments.length) return lobes.map(function(lobes) {
63
- return lobes.map(function(lobe) {
64
- return [
65
- [lobe[0][0] * 180 / π, lobe[0][1] * 180 / π],
66
- [lobe[1][0] * 180 / π, lobe[1][1] * 180 / π],
67
- [lobe[2][0] * 180 / π, lobe[2][1] * 180 / π]
68
- ];
69
- });
70
- });
71
- lobes = _.map(function(lobes) {
72
- return lobes.map(function(lobe) {
73
- return [
74
- [lobe[0][0] * π / 180, lobe[0][1] * π / 180],
75
- [lobe[1][0] * π / 180, lobe[1][1] * π / 180],
76
- [lobe[2][0] * π / 180, lobe[2][1] * π / 180]
77
- ];
78
- });
79
- });
80
- reset();
81
- return projection;
82
- };
83
-
84
- function sphere() {
85
- var ε = 1e-6,
86
- coordinates = [];
87
-
88
- // Northern Hemisphere
89
- for (var i = 0, n = lobes[0].length; i < n; ++i) {
90
- var lobe = lobes[0][i],
91
- λ0 = lobe[0][0] * 180 / π,
92
- φ0 = lobe[0][1] * 180 / π,
93
- φ1 = lobe[1][1] * 180 / π,
94
- λ2 = lobe[2][0] * 180 / π,
95
- φ2 = lobe[2][1] * 180 / π;
96
- coordinates.push(resample([
97
- [λ0 + ε, φ0 + ε],
98
- [λ0 + ε, φ1 - ε],
99
- [λ2 - ε, φ1 - ε],
100
- [λ2 - ε, φ2 + ε]
101
- ], 30));
102
- }
103
-
104
- // Southern Hemisphere
105
- for (var i = lobes[1].length - 1; i >= 0; --i) {
106
- var lobe = lobes[1][i],
107
- λ0 = lobe[0][0] * 180 / π,
108
- φ0 = lobe[0][1] * 180 / π,
109
- φ1 = lobe[1][1] * 180 / π,
110
- λ2 = lobe[2][0] * 180 / π,
111
- φ2 = lobe[2][1] * 180 / π;
112
- coordinates.push(resample([
113
- [λ2 - ε, φ2 - ε],
114
- [λ2 - ε, φ1 + ε],
115
- [λ0 + ε, φ1 + ε],
116
- [λ0 + ε, φ0 - ε]
117
- ], 30));
118
- }
119
-
120
- return {
121
- type: "Polygon",
122
- coordinates: [d3.merge(coordinates)]
123
- };
124
- }
125
-
126
- function resample(coordinates, m) {
127
- var i = -1,
128
- n = coordinates.length,
129
- p0 = coordinates[0],
130
- p1,
131
- dx,
132
- dy,
133
- resampled = [];
134
- while (++i < n) {
135
- p1 = coordinates[i];
136
- dx = (p1[0] - p0[0]) / m;
137
- dy = (p1[1] - p0[1]) / m;
138
- for (var j = 0; j < m; ++j) resampled.push([p0[0] + j * dx, p0[1] + j * dy]);
139
- p0 = p1;
140
- }
141
- resampled.push(p1);
142
- return resampled;
143
- }
144
-
145
- function pointEqual(a, b) {
146
- return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε;
147
- }
148
-
149
- return projection;
150
- };
@@ -1,17 +0,0 @@
1
- import "projection";
2
-
3
- function kavrayskiy7(λ, φ) {
4
- return [
5
- 3 * λ / (2 * π) * Math.sqrt(π * π / 3 - φ * φ),
6
- φ
7
- ];
8
- }
9
-
10
- kavrayskiy7.invert = function(x, y) {
11
- return [
12
- 2 / 3 * π * x / Math.sqrt(π * π / 3 - y * y),
13
- y
14
- ];
15
- };
16
-
17
- (d3.geo.kavrayskiy7 = function() { return projection(kavrayskiy7); }).raw = kavrayskiy7;
@@ -1,47 +0,0 @@
1
- import "projection";
2
-
3
- function lagrange(n) {
4
- function forward(λ, φ) {
5
- if (Math.abs(Math.abs(φ) - π / 2) < ε) return [0, φ < 0 ? -2 : 2];
6
- var sinφ = Math.sin(φ),
7
- v = Math.pow((1 + sinφ) / (1 - sinφ), n / 2),
8
- c = .5 * (v + 1 / v) + Math.cos(λ *= n);
9
- return [
10
- 2 * Math.sin(λ) / c,
11
- (v - 1 / v) / c
12
- ];
13
- }
14
-
15
- forward.invert = function(x, y) {
16
- var y0 = Math.abs(y);
17
- if (Math.abs(y0 - 2) < ε) return x ? null : [0, sgn(y) * π / 2];
18
- if (y0 > 2) return null;
19
-
20
- x /= 2, y /= 2;
21
- var x2 = x * x,
22
- y2 = y * y,
23
- t = 2 * y / (1 + x2 + y2); // tanh(nφ)
24
- t = Math.pow((1 + t) / (1 - t), 1 / n);
25
- return [
26
- Math.atan2(2 * x, 1 - x2 - y2) / n,
27
- asin((t - 1) / (t + 1))
28
- ];
29
- };
30
-
31
- return forward;
32
- }
33
-
34
- function lagrangeProjection() {
35
- var n = .5,
36
- m = projectionMutator(lagrange),
37
- p = m(n);
38
-
39
- p.spacing = function(_) {
40
- if (!arguments.length) return n;
41
- return m(n = +_);
42
- };
43
-
44
- return p;
45
- }
46
-
47
- (d3.geo.lagrange = lagrangeProjection).raw = lagrange;
@@ -1,41 +0,0 @@
1
- import "projection";
2
-
3
- function larrivee(λ, φ) {
4
- return [
5
- λ * (1 + Math.sqrt(Math.cos(φ))) / 2,
6
- φ / (Math.cos(φ / 2) * Math.cos(λ / 6))
7
- ];
8
- }
9
-
10
- larrivee.invert = function(x, y) {
11
- var x0 = Math.abs(x),
12
- y0 = Math.abs(y),
13
- π_sqrt2 = π / Math.SQRT2,
14
- λ = ε,
15
- φ = π / 2;
16
- if (y0 < π_sqrt2) φ *= y0 / π_sqrt2;
17
- else λ += 6 * acos(π_sqrt2 / y0);
18
- for (var i = 0; i < 25; i++) {
19
- var sinφ = Math.sin(φ),
20
- sqrtcosφ = asqrt(Math.cos(φ)),
21
- sinφ_2 = Math.sin(φ / 2),
22
- cosφ_2 = Math.cos(φ / 2),
23
- sinλ_6 = Math.sin(λ / 6),
24
- cosλ_6 = Math.cos(λ / 6),
25
- f0 = .5 * λ * (1 + sqrtcosφ) - x0,
26
- f1 = φ / (cosφ_2 * cosλ_6) - y0,
27
- df0dφ = sqrtcosφ ? -.25 * λ * sinφ / sqrtcosφ : 0,
28
- df0dλ = .5 * (1 + sqrtcosφ),
29
- df1dφ = (1 + .5 * φ * sinφ_2 / cosφ_2) / (cosφ_2 * cosλ_6),
30
- df1dλ = (φ / cosφ_2) * (sinλ_6 / 6) / (cosλ_6 * cosλ_6),
31
- denom = df0dφ * df1dλ - df1dφ * df0dλ,
32
- dφ = (f0 * df1dλ - f1 * df0dλ) / denom,
33
- dλ = (f1 * df0dφ - f0 * df1dφ) / denom;
34
- φ -= dφ;
35
- λ -= dλ;
36
- if (Math.abs(dφ) < ε && Math.abs(dλ) < ε) break;
37
- }
38
- return [x < 0 ? -λ : λ, y < 0 ? -φ : φ];
39
- };
40
-
41
- (d3.geo.larrivee = function() { return projection(larrivee); }).raw = larrivee;
@@ -1,33 +0,0 @@
1
- import "projection";
2
-
3
- function laskowski(λ, φ) {
4
- var λ2 = λ * λ, φ2 = φ * φ;
5
- return [
6
- λ * (.975534 + φ2 * (-.119161 + λ2 * -.0143059 + φ2 * -.0547009)),
7
- φ * (1.00384 + λ2 * (.0802894 + φ2 * -.02855 + λ2 * .000199025) + φ2 * (.0998909 + φ2 * -.0491032))
8
- ];
9
- }
10
-
11
- laskowski.invert = function(x, y) {
12
- var λ = sgn(x) * π,
13
- φ = y / 2,
14
- i = 50;
15
- do {
16
- var λ2 = λ * λ,
17
- φ2 = φ * φ,
18
- λφ = λ * φ,
19
- fx = λ * (.975534 + φ2 * (-.119161 + λ2 * -.0143059 + φ2 * -.0547009)) - x,
20
- fy = φ * (1.00384 + λ2 * (.0802894 + φ2 * -.02855 + λ2 * .000199025) + φ2 * (.0998909 + φ2 * -.0491032)) - y,
21
- δxδλ = .975534 - φ2 * (.119161 + 3 * λ2 * .0143059 + φ2 * .0547009),
22
- δxδφ = -λφ * (2 * .119161 + 4 * .0547009 * φ2 + 2 * .0143059 * λ2),
23
- δyδλ = λφ * (2 * .0802894 + 4 * .000199025 * λ2 + 2 * -.02855 * φ2),
24
- δyδφ = 1.00384 + λ2 * (.0802894 + .000199025 * λ2) + φ2 * (3 * (.0998909 - .02855 * λ2) - 5 * .0491032 * φ2),
25
- denominator = δxδφ * δyδλ - δyδφ * δxδλ,
26
- δλ = (fy * δxδφ - fx * δyδφ) / denominator,
27
- δφ = (fx * δyδλ - fy * δxδλ) / denominator;
28
- λ -= δλ, φ -= δφ;
29
- } while ((Math.abs(δλ) > ε || Math.abs(δφ) > ε) && --i > 0);
30
- return i && [λ, φ];
31
- };
32
-
33
- (d3.geo.laskowski = function() { return projection(laskowski); }).raw = laskowski;
@@ -1,23 +0,0 @@
1
- import "projection";
2
-
3
- function littrow(λ, φ) {
4
- return [
5
- Math.sin(λ) / Math.cos(φ),
6
- Math.tan(φ) * Math.cos(λ)
7
- ];
8
- }
9
-
10
- littrow.invert = function(x, y) {
11
- var x2 = x * x,
12
- y2 = y * y,
13
- y2_1 = y2 + 1,
14
- cosφ = x
15
- ? Math.SQRT1_2 * Math.sqrt((y2_1 - Math.sqrt(x2 * x2 + 2 * x2 * (y2 - 1) + y2_1 * y2_1)) / x2 + 1)
16
- : 1 / Math.sqrt(y2_1);
17
- return [
18
- asin(x * cosφ),
19
- sgn(y) * acos(cosφ)
20
- ];
21
- };
22
-
23
- (d3.geo.littrow = function() { return projection(littrow); }).raw = littrow;
@@ -1,30 +0,0 @@
1
- import "projection";
2
- import "parallel1";
3
-
4
- function loximuthal(φ0) {
5
- var cosφ0 = Math.cos(φ0),
6
- tanφ0 = Math.tan(π / 4 + φ0 / 2);
7
-
8
- function forward(λ, φ) {
9
- var y = φ - φ0,
10
- x = Math.abs(y) < ε ? λ * cosφ0
11
- : Math.abs(x = π / 4 + φ / 2) < ε || Math.abs(Math.abs(x) - π / 2) < ε
12
- ? 0 : λ * y / Math.log(Math.tan(x) / tanφ0);
13
- return [x, y];
14
- }
15
-
16
- forward.invert = function(x, y) {
17
- var λ,
18
- φ = y + φ0;
19
- return [
20
- Math.abs(y) < ε ? x / cosφ0
21
- : (Math.abs(λ = π / 4 + φ / 2) < ε || Math.abs(Math.abs(λ) - π / 2) < ε) ? 0
22
- : x * Math.log(Math.tan(λ) / tanφ0) / y,
23
- φ
24
- ];
25
- };
26
-
27
- return forward;
28
- }
29
-
30
- (d3.geo.loximuthal = function() { return parallel1Projection(loximuthal).parallel(40); }).raw = loximuthal;
@@ -1,26 +0,0 @@
1
- var ε = 1e-6,
2
- ε2 = ε * ε,
3
- π = Math.PI,
4
- sqrtπ = Math.sqrt(π),
5
- radians = π / 180,
6
- degrees = 180 / π;
7
-
8
- function sinci(x) {
9
- return x ? x / Math.sin(x) : 1;
10
- }
11
-
12
- function sgn(x) {
13
- return x > 0 ? 1 : x < 0 ? -1 : 0;
14
- }
15
-
16
- function asin(x) {
17
- return x > 1 ? π / 2 : x < -1 ? -π / 2 : Math.asin(x);
18
- }
19
-
20
- function acos(x) {
21
- return x > 1 ? 0 : x < -1 ? π : Math.acos(x);
22
- }
23
-
24
- function asqrt(x) {
25
- return x > 0 ? Math.sqrt(x) : 0;
26
- }
@@ -1,17 +0,0 @@
1
- import "projection";
2
-
3
- function miller(λ, φ) {
4
- return [
5
- λ,
6
- 1.25 * Math.log(Math.tan(π / 4 + .4 * φ))
7
- ];
8
- }
9
-
10
- miller.invert = function(x, y) {
11
- return [
12
- x,
13
- 2.5 * Math.atan(Math.exp(.8 * y)) - .625 * π
14
- ];
15
- };
16
-
17
- (d3.geo.miller = function() { return projection(miller); }).raw = miller;
@@ -1,106 +0,0 @@
1
- import "projection";
2
-
3
- function modifiedStereographic(C) {
4
- var m = C.length - 1;
5
-
6
- function forward(λ, φ) {
7
- var cosφ = Math.cos(φ),
8
- k = 2 / (1 + cosφ * Math.cos(λ)),
9
- zr = k * cosφ * Math.sin(λ),
10
- zi = k * Math.sin(φ),
11
- i = m,
12
- w = C[i],
13
- ar = w[0],
14
- ai = w[1],
15
- t;
16
- while (--i >= 0) {
17
- w = C[i];
18
- ar = w[0] + zr * (t = ar) - zi * ai;
19
- ai = w[1] + zr * ai + zi * t;
20
- }
21
- ar = zr * (t = ar) - zi * ai;
22
- ai = zr * ai + zi * t;
23
- return [ar, ai];
24
- }
25
-
26
- forward.invert = function(x, y) {
27
- var i = 20,
28
- zr = x,
29
- zi = y;
30
- do {
31
- var j = m,
32
- w = C[j],
33
- ar = w[0],
34
- ai = w[1],
35
- br = 0,
36
- bi = 0,
37
- t;
38
-
39
- while (--j >= 0) {
40
- w = C[j];
41
- br = ar + zr * (t = br) - zi * bi;
42
- bi = ai + zr * bi + zi * t;
43
- ar = w[0] + zr * (t = ar) - zi * ai;
44
- ai = w[1] + zr * ai + zi * t;
45
- }
46
- br = ar + zr * (t = br) - zi * bi;
47
- bi = ai + zr * bi + zi * t;
48
- ar = zr * (t = ar) - zi * ai - x;
49
- ai = zr * ai + zi * t - y;
50
-
51
- var denominator = br * br + bi * bi, δr, δi;
52
- zr -= δr = (ar * br + ai * bi) / denominator;
53
- zi -= δi = (ai * br - ar * bi) / denominator;
54
- } while (Math.abs(δr) + Math.abs(δi) > ε * ε && --i > 0);
55
-
56
- if (i) {
57
- var ρ = Math.sqrt(zr * zr + zi * zi),
58
- c = 2 * Math.atan(ρ * .5),
59
- sinc = Math.sin(c);
60
- return [Math.atan2(zr * sinc, ρ * Math.cos(c)), ρ ? asin(zi * sinc / ρ) : 0];
61
- }
62
- };
63
-
64
- return forward;
65
- }
66
-
67
- var modifiedStereographicCoefficients = {
68
- alaska: [
69
- [ .9972523, 0],
70
- [ .0052513, -.0041175],
71
- [ .0074606, .0048125],
72
- [-.0153783, -.1968253],
73
- [ .0636871, -.1408027],
74
- [ .3660976, -.2937382]
75
- ],
76
- gs48: [[.98879, 0], [0, 0], [-.050909, 0], [0, 0], [.075528, 0]],
77
- gs50: [
78
- [ .9842990, 0],
79
- [ .0211642, .0037608],
80
- [-.1036018, -.0575102],
81
- [-.0329095, -.0320119],
82
- [ .0499471, .1223335],
83
- [ .0260460, .0899805],
84
- [ .0007388, -.1435792],
85
- [ .0075848, -.1334108],
86
- [-.0216473, .0776645],
87
- [-.0225161, .0853673]
88
- ],
89
- miller: [[.9245, 0], [0, 0], [.01943, 0]],
90
- lee: [[.721316, 0], [0, 0], [-.00881625, -.00617325]]
91
- };
92
-
93
- function modifiedStereographicProjection() {
94
- var coefficients = modifiedStereographicCoefficients.miller,
95
- m = projectionMutator(modifiedStereographic),
96
- p = m(coefficients);
97
-
98
- p.coefficients = function(_) {
99
- if (!arguments.length) return coefficients;
100
- return m(coefficients = typeof _ === "string" ? modifiedStereographicCoefficients[_] : _);
101
- };
102
-
103
- return p;
104
- }
105
-
106
- (d3.geo.modifiedStereographic = modifiedStereographicProjection).raw = modifiedStereographic;
@@ -1,37 +0,0 @@
1
- import "projection";
2
-
3
- function mollweideBromleyθ(Cp) {
4
- return function(θ) {
5
- var Cpsinθ = Cp * Math.sin(θ),
6
- i = 30, δ;
7
- do θ -= δ = (θ + Math.sin(θ) - Cpsinθ) / (1 + Math.cos(θ));
8
- while (Math.abs(δ) > ε && --i > 0);
9
- return θ / 2;
10
- };
11
- }
12
-
13
- function mollweideBromley(Cx, Cy, Cp) {
14
- var θ = mollweideBromleyθ(Cp);
15
-
16
- function forward(λ, φ) {
17
- return [
18
- Cx * λ * Math.cos(φ = θ(φ)),
19
- Cy * Math.sin(φ)
20
- ];
21
- }
22
-
23
- forward.invert = function(x, y) {
24
- var θ = asin(y / Cy);
25
- return [
26
- x / (Cx * Math.cos(θ)),
27
- asin((2 * θ + Math.sin(2 * θ)) / Cp)
28
- ];
29
- };
30
-
31
- return forward;
32
- }
33
-
34
- var mollweideθ = mollweideBromleyθ(π),
35
- mollweide = mollweideBromley(2 * Math.SQRT2 / π, Math.SQRT2, π);
36
-
37
- (d3.geo.mollweide = function() { return projection(mollweide); }).raw = mollweide;
@@ -1,23 +0,0 @@
1
- import "projection";
2
-
3
- function mtFlatPolarParabolic(λ, φ) {
4
- var sqrt6 = Math.sqrt(6),
5
- sqrt7 = Math.sqrt(7),
6
- θ = Math.asin(7 * Math.sin(φ) / (3 * sqrt6));
7
- return [
8
- sqrt6 * λ * (2 * Math.cos(2 * θ / 3) - 1) / sqrt7,
9
- 9 * Math.sin(θ / 3) / sqrt7
10
- ];
11
- }
12
-
13
- mtFlatPolarParabolic.invert = function(x, y) {
14
- var sqrt6 = Math.sqrt(6),
15
- sqrt7 = Math.sqrt(7),
16
- θ = 3 * asin(y * sqrt7 / 9);
17
- return [
18
- x * sqrt7 / (sqrt6 * (2 * Math.cos(2 * θ / 3) - 1)),
19
- asin(Math.sin(θ) * 3 * sqrt6 / 7)
20
- ];
21
- };
22
-
23
- (d3.geo.mtFlatPolarParabolic = function() { return projection(mtFlatPolarParabolic); }).raw = mtFlatPolarParabolic;
@@ -1,25 +0,0 @@
1
- import "projection";
2
-
3
- function mtFlatPolarQuartic(λ, φ) {
4
- var k = (1 + Math.SQRT1_2) * Math.sin(φ),
5
- θ = φ;
6
- for (var i = 0, δ; i < 25; i++) {
7
- θ -= δ = (Math.sin(θ / 2) + Math.sin(θ) - k) / (.5 * Math.cos(θ / 2) + Math.cos(θ));
8
- if (Math.abs(δ) < ε) break;
9
- }
10
- return [
11
- λ * (1 + 2 * Math.cos(θ) / Math.cos(θ / 2)) / (3 * Math.SQRT2),
12
- 2 * Math.sqrt(3) * Math.sin(θ / 2) / Math.sqrt(2 + Math.SQRT2)
13
- ];
14
- }
15
-
16
- mtFlatPolarQuartic.invert = function(x, y) {
17
- var sinθ_2 = y * Math.sqrt(2 + Math.SQRT2) / (2 * Math.sqrt(3)),
18
- θ = 2 * asin(sinθ_2);
19
- return [
20
- 3 * Math.SQRT2 * x / (1 + 2 * Math.cos(θ) / Math.cos(θ / 2)),
21
- asin((sinθ_2 + Math.sin(θ)) / (1 + Math.SQRT1_2))
22
- ];
23
- };
24
-
25
- (d3.geo.mtFlatPolarQuartic = function() { return projection(mtFlatPolarQuartic); }).raw = mtFlatPolarQuartic;
@@ -1,27 +0,0 @@
1
- import "projection";
2
-
3
- function mtFlatPolarSinusoidal(λ, φ) {
4
- var A = Math.sqrt(6 / (4 + π)),
5
- k = (1 + π / 4) * Math.sin(φ),
6
- θ = φ / 2;
7
- for (var i = 0, δ; i < 25; i++) {
8
- θ -= δ = (θ / 2 + Math.sin(θ) - k) / (.5 + Math.cos(θ));
9
- if (Math.abs(δ) < ε) break;
10
- }
11
- return [
12
- A * (.5 + Math.cos(θ)) * λ / 1.5,
13
- A * θ
14
- ];
15
- }
16
-
17
- mtFlatPolarSinusoidal.invert = function(x, y) {
18
- var A = Math.sqrt(6 / (4 + π)),
19
- θ = y / A;
20
- if (Math.abs(Math.abs(θ) - π / 2) < ε) θ = θ < 0 ? -π / 2 : π / 2;
21
- return [
22
- 1.5 * x / (A * (.5 + Math.cos(θ))),
23
- asin((θ / 2 + Math.sin(θ)) / (1 + π / 4))
24
- ];
25
- };
26
-
27
- (d3.geo.mtFlatPolarSinusoidal = function() { return projection(mtFlatPolarSinusoidal); }).raw = mtFlatPolarSinusoidal;
@@ -1,24 +0,0 @@
1
- import "projection";
2
-
3
- function naturalEarth(λ, φ) {
4
- var φ2 = φ * φ, φ4 = φ2 * φ2;
5
- return [
6
- λ * (.8707 - .131979 * φ2 + φ4 * (-.013791 + φ4 * (.003971 * φ2 - .001529 * φ4))),
7
- φ * (1.007226 + φ2 * (.015085 + φ4 * (-.044475 + .028874 * φ2 - .005916 * φ4)))
8
- ];
9
- }
10
-
11
- naturalEarth.invert = function(x, y) {
12
- var φ = y, i = 25, δ;
13
- do {
14
- var φ2 = φ * φ, φ4 = φ2 * φ2;
15
- φ -= δ = (φ * (1.007226 + φ2 * (.015085 + φ4 * (-.044475 + .028874 * φ2 - .005916 * φ4))) - y) /
16
- (1.007226 + φ2 * (.015085 * 3 + φ4 * (-.044475 * 7 + .028874 * 9 * φ2 - .005916 * 11 * φ4)));
17
- } while (Math.abs(δ) > ε && --i > 0);
18
- return [
19
- x / (.8707 + (φ2 = φ * φ) * (-.131979 + φ2 * (-.013791 + φ2 * φ2 * φ2 * (.003971 - .001529 * φ2)))),
20
- φ
21
- ];
22
- };
23
-
24
- (d3.geo.naturalEarth = function() { return projection(naturalEarth); }).raw = naturalEarth;
@@ -1,22 +0,0 @@
1
- import "projection";
2
-
3
- function nellHammer(λ, φ) {
4
- return [
5
- λ * (1 + Math.cos(φ)) / 2,
6
- 2 * (φ - Math.tan(φ / 2))
7
- ];
8
- }
9
-
10
- nellHammer.invert = function(x, y) {
11
- var p = y / 2;
12
- for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) {
13
- var c = Math.cos(y / 2);
14
- y -= δ = (y - Math.tan(y / 2) - p) / (1 - .5 / (c * c));
15
- }
16
- return [
17
- 2 * x / (1 + Math.cos(y)),
18
- y
19
- ];
20
- };
21
-
22
- (d3.geo.nellHammer = function() { return projection(nellHammer); }).raw = nellHammer;
@@ -1,14 +0,0 @@
1
- import "projection";
2
-
3
- function parallel1Projection(projectAt) {
4
- var φ0 = 0,
5
- m = projectionMutator(projectAt),
6
- p = m(φ0);
7
-
8
- p.parallel = function(_) {
9
- if (!arguments.length) return φ0 / π * 180;
10
- return m(φ0 = _ * π / 180);
11
- };
12
-
13
- return p;
14
- }