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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/d3js-plugins-rails/version.rb +2 -2
- data/vendor/assets/javascripts/d3/plugins/LICENSE +1 -1
- data/vendor/assets/javascripts/d3/plugins/README.md +0 -14
- data/vendor/assets/javascripts/d3/plugins/geo/projection/README.md +1 -252
- data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/README.md +9 -0
- data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/interpolate-zoom-test.js +27 -0
- data/vendor/assets/javascripts/d3/plugins/interpolate-zoom/interpolate-zoom.js +18 -32
- data.tar.gz.sig +0 -0
- metadata +4 -140
- metadata.gz.sig +2 -5
- data/vendor/assets/javascripts/d3/plugins/.gitignore +0 -1
- data/vendor/assets/javascripts/d3/plugins/Makefile +0 -18
- data/vendor/assets/javascripts/d3/plugins/geo/projection/airy.js +0 -55
- data/vendor/assets/javascripts/d3/plugins/geo/projection/aitoff.js +0 -42
- data/vendor/assets/javascripts/d3/plugins/geo/projection/armadillo.js +0 -81
- data/vendor/assets/javascripts/d3/plugins/geo/projection/august.js +0 -36
- data/vendor/assets/javascripts/d3/plugins/geo/projection/baker.js +0 -30
- data/vendor/assets/javascripts/d3/plugins/geo/projection/berghaus.js +0 -76
- data/vendor/assets/javascripts/d3/plugins/geo/projection/boggs.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/bonne.js +0 -30
- data/vendor/assets/javascripts/d3/plugins/geo/projection/bromley.js +0 -6
- data/vendor/assets/javascripts/d3/plugins/geo/projection/chamberlin.js +0 -116
- data/vendor/assets/javascripts/d3/plugins/geo/projection/collignon.js +0 -19
- data/vendor/assets/javascripts/d3/plugins/geo/projection/craig.js +0 -31
- data/vendor/assets/javascripts/d3/plugins/geo/projection/craster.js +0 -20
- data/vendor/assets/javascripts/d3/plugins/geo/projection/cylindrical-equal-area.js +0 -24
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert1.js +0 -20
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert2.js +0 -19
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert3.js +0 -19
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert4.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert5.js +0 -19
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eckert6.js +0 -24
- data/vendor/assets/javascripts/d3/plugins/geo/projection/eisenlohr.js +0 -78
- data/vendor/assets/javascripts/d3/plugins/geo/projection/elliptic.js +0 -118
- data/vendor/assets/javascripts/d3/plugins/geo/projection/end.js +0 -1
- data/vendor/assets/javascripts/d3/plugins/geo/projection/fahey.js +0 -21
- data/vendor/assets/javascripts/d3/plugins/geo/projection/gall-stereographic.js +0 -19
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg-polyconic.js +0 -56
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg4.js +0 -6
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg5.js +0 -6
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg6.js +0 -6
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg8.js +0 -29
- data/vendor/assets/javascripts/d3/plugins/geo/projection/ginzburg9.js +0 -6
- data/vendor/assets/javascripts/d3/plugins/geo/projection/gringorten.js +0 -150
- data/vendor/assets/javascripts/d3/plugins/geo/projection/guyou.js +0 -55
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer-retroazimuthal.js +0 -106
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hammer.js +0 -53
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hatano.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/healpix.js +0 -85
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hill.js +0 -66
- data/vendor/assets/javascripts/d3/plugins/geo/projection/homolosine.js +0 -18
- data/vendor/assets/javascripts/d3/plugins/geo/projection/hyperbolic.js +0 -22
- data/vendor/assets/javascripts/d3/plugins/geo/projection/index.js +0 -72
- data/vendor/assets/javascripts/d3/plugins/geo/projection/interrupt.js +0 -150
- data/vendor/assets/javascripts/d3/plugins/geo/projection/kavrayskiy7.js +0 -17
- data/vendor/assets/javascripts/d3/plugins/geo/projection/lagrange.js +0 -47
- data/vendor/assets/javascripts/d3/plugins/geo/projection/larrivee.js +0 -41
- data/vendor/assets/javascripts/d3/plugins/geo/projection/laskowski.js +0 -33
- data/vendor/assets/javascripts/d3/plugins/geo/projection/littrow.js +0 -23
- data/vendor/assets/javascripts/d3/plugins/geo/projection/loximuthal.js +0 -30
- data/vendor/assets/javascripts/d3/plugins/geo/projection/math.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/miller.js +0 -17
- data/vendor/assets/javascripts/d3/plugins/geo/projection/modified-stereographic.js +0 -106
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mollweide.js +0 -37
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-parabolic.js +0 -23
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-quartic.js +0 -25
- data/vendor/assets/javascripts/d3/plugins/geo/projection/mt-flat-polar-sinusoidal.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/natural-earth.js +0 -24
- data/vendor/assets/javascripts/d3/plugins/geo/projection/nell-hammer.js +0 -22
- data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel1.js +0 -14
- data/vendor/assets/javascripts/d3/plugins/geo/projection/parallel2.js +0 -15
- data/vendor/assets/javascripts/d3/plugins/geo/projection/peirce-quincuncial.js +0 -7
- data/vendor/assets/javascripts/d3/plugins/geo/projection/polyconic.js +0 -31
- data/vendor/assets/javascripts/d3/plugins/geo/projection/projection.js +0 -4
- data/vendor/assets/javascripts/d3/plugins/geo/projection/quincuncial.js +0 -73
- data/vendor/assets/javascripts/d3/plugins/geo/projection/rectangular-polyconic.js +0 -41
- data/vendor/assets/javascripts/d3/plugins/geo/projection/robinson.js +0 -85
- data/vendor/assets/javascripts/d3/plugins/geo/projection/satellite.js +0 -70
- data/vendor/assets/javascripts/d3/plugins/geo/projection/sinu-mollweide.js +0 -20
- data/vendor/assets/javascripts/d3/plugins/geo/projection/sinusoidal.js +0 -17
- data/vendor/assets/javascripts/d3/plugins/geo/projection/start.js +0 -1
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/airy-test.js +0 -25
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/aitoff-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/armadillo-test.js +0 -30
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/assert.js +0 -32
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/august-test.js +0 -29
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/baker-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/berghaus-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/boggs-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/bonne-test.js +0 -45
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craig-test.js +0 -40
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/craster-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/eckert4-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/eisenlohr-test.js +0 -36
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/equirectangular-test.js +0 -96
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/fahey-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg4-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg5-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg6-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg8-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/ginzburg9-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/gringorten-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/guyou-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hammer-retroazimuthal-test.js +0 -39
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hammer-test.js +0 -29
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hatano-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/healpix-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/hill-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/lagrange-test.js +0 -59
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/larrivee-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/laskowski-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/littrow-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/load.js +0 -20
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/loximuthal-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/modified-stereographic-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mollweide-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-parabolic-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-quartic-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/mt-flat-polar-sinusoidal-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/natural-earth-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/peirce-quincuncial-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/polyconic-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/quartic-authalic-test.js +0 -0
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/rectangular-polyconic-test.js +0 -48
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/robinson-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/times-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/two-point-azimuthal-test.js +0 -24
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/two-point-equidistant-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten2-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten3-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/van-der-grinten4-test.js +0 -32
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/wagner6-test.js +0 -27
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/wiechel-test.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/test/winkel3-test.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/times.js +0 -21
- data/vendor/assets/javascripts/d3/plugins/geo/projection/two-point-azimuthal.js +0 -47
- data/vendor/assets/javascripts/d3/plugins/geo/projection/two-point-equidistant.js +0 -83
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten.js +0 -43
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten2.js +0 -30
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten3.js +0 -26
- data/vendor/assets/javascripts/d3/plugins/geo/projection/van-der-grinten4.js +0 -56
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner4.js +0 -10
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner6.js +0 -17
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wagner7.js +0 -24
- data/vendor/assets/javascripts/d3/plugins/geo/projection/wiechel.js +0 -28
- data/vendor/assets/javascripts/d3/plugins/geo/projection/winkel3.js +0 -41
- data/vendor/assets/javascripts/d3/plugins/package.json +0 -22
@@ -1,116 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function chamberlin(points) {
|
4
|
-
points = points.map(function(p) {
|
5
|
-
return [p[0], p[1], Math.sin(p[1]), Math.cos(p[1])];
|
6
|
-
});
|
7
|
-
|
8
|
-
for (var a = points[2], b, i = 0; i < 3; ++i, a = b) {
|
9
|
-
b = points[i];
|
10
|
-
a.v = chamberlinDistanceAzimuth(b[1] - a[1], a[3], a[2], b[3], b[2], b[0] - a[0]);
|
11
|
-
a.point = [0, 0];
|
12
|
-
}
|
13
|
-
|
14
|
-
var β0 = chamberlinAngle(points[0].v[0], points[2].v[0], points[1].v[0]),
|
15
|
-
β1 = chamberlinAngle(points[0].v[0], points[1].v[0], points[2].v[0]),
|
16
|
-
β2 = π - β0;
|
17
|
-
|
18
|
-
points[2].point[1] = 0;
|
19
|
-
points[0].point[0] = -(points[1].point[0] = .5 * points[0].v[0]);
|
20
|
-
|
21
|
-
var mean = [
|
22
|
-
points[2].point[0] = points[0].point[0] + points[2].v[0] * Math.cos(β0),
|
23
|
-
2 * (points[0].point[1] = points[1].point[1] = points[2].v[0] * Math.sin(β0))
|
24
|
-
];
|
25
|
-
|
26
|
-
function forward(λ, φ) {
|
27
|
-
var sinφ = Math.sin(φ),
|
28
|
-
cosφ = Math.cos(φ),
|
29
|
-
v = new Array(3);
|
30
|
-
|
31
|
-
// Compute distance and azimuth from control points.
|
32
|
-
for (var i = 0; i < 3; ++i) {
|
33
|
-
var p = points[i];
|
34
|
-
v[i] = chamberlinDistanceAzimuth(φ - p[1], p[3], p[2], cosφ, sinφ, λ - p[0]);
|
35
|
-
if (!v[i][0]) return p.point;
|
36
|
-
v[i][1] = chamberlinLongitude(v[i][1] - p.v[1]);
|
37
|
-
}
|
38
|
-
|
39
|
-
// Arithmetic mean of interception points.
|
40
|
-
var point = mean.slice();
|
41
|
-
for (var i = 0; i < 3; ++i) {
|
42
|
-
var j = i == 2 ? 0 : i + 1;
|
43
|
-
var a = chamberlinAngle(points[i].v[0], v[i][0], v[j][0]);
|
44
|
-
if (v[i][1] < 0) a = -a;
|
45
|
-
|
46
|
-
if (!i) {
|
47
|
-
point[0] += v[i][0] * Math.cos(a);
|
48
|
-
point[1] -= v[i][0] * Math.sin(a);
|
49
|
-
} else if (i == 1) {
|
50
|
-
a = β1 - a;
|
51
|
-
point[0] -= v[i][0] * Math.cos(a);
|
52
|
-
point[1] -= v[i][0] * Math.sin(a);
|
53
|
-
} else {
|
54
|
-
a = β2 - a;
|
55
|
-
point[0] += v[i][0] * Math.cos(a);
|
56
|
-
point[1] += v[i][0] * Math.sin(a);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
point[0] /= 3, point[1] /= 3;
|
61
|
-
return point;
|
62
|
-
}
|
63
|
-
|
64
|
-
return forward;
|
65
|
-
}
|
66
|
-
|
67
|
-
function chamberlinProjection() {
|
68
|
-
var points = [[0, 0], [0, 0], [0, 0]],
|
69
|
-
m = projectionMutator(chamberlin),
|
70
|
-
p = m(points),
|
71
|
-
rotate = p.rotate;
|
72
|
-
|
73
|
-
delete p.rotate;
|
74
|
-
|
75
|
-
p.points = function(_) {
|
76
|
-
if (!arguments.length) return points;
|
77
|
-
points = _;
|
78
|
-
var origin = d3.geo.centroid({type: "MultiPoint", coordinates: points}),
|
79
|
-
r = [-origin[0], -origin[1]];
|
80
|
-
rotate.call(p, r);
|
81
|
-
return m(points.map(d3.geo.rotation(r)).map(chamberlinRadians));
|
82
|
-
};
|
83
|
-
|
84
|
-
return p.points([[-150, 55], [-35, 55], [-92.5, 10]]);
|
85
|
-
}
|
86
|
-
|
87
|
-
function chamberlinDistanceAzimuth(dφ, c1, s1, c2, s2, dλ) {
|
88
|
-
var cosdλ = Math.cos(dλ),
|
89
|
-
r;
|
90
|
-
if (Math.abs(dφ) > 1 || Math.abs(dλ) > 1) {
|
91
|
-
r = acos(s1 * s2 + c1 * c2 * cosdλ);
|
92
|
-
} else {
|
93
|
-
var sindφ = Math.sin(.5 * dφ), sindλ = Math.sin(.5 * dλ);
|
94
|
-
r = 2 * asin(Math.sqrt(sindφ * sindφ + c1 * c2 * sindλ * sindλ));
|
95
|
-
}
|
96
|
-
if (Math.abs(r) > ε) {
|
97
|
-
return [r, Math.atan2(c2 * Math.sin(dλ), c1 * s2 - s1 * c2 * cosdλ)];
|
98
|
-
}
|
99
|
-
return [0, 0];
|
100
|
-
}
|
101
|
-
|
102
|
-
// Angle opposite a, and contained between sides of lengths b and c.
|
103
|
-
function chamberlinAngle(b, c, a) {
|
104
|
-
return acos(.5 * (b * b + c * c - a * a) / (b * c));
|
105
|
-
}
|
106
|
-
|
107
|
-
// Normalize longitude.
|
108
|
-
function chamberlinLongitude(λ) {
|
109
|
-
return λ - 2 * π * Math.floor((λ + π) / (2 * π));
|
110
|
-
}
|
111
|
-
|
112
|
-
function chamberlinRadians(point) {
|
113
|
-
return [point[0] * radians, point[1] * radians];
|
114
|
-
}
|
115
|
-
|
116
|
-
(d3.geo.chamberlin = chamberlinProjection).raw = chamberlin;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function collignon(λ, φ) {
|
4
|
-
var α = asqrt(1 - Math.sin(φ));
|
5
|
-
return [
|
6
|
-
(2 / sqrtπ) * λ * α,
|
7
|
-
sqrtπ * (1 - α)
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
collignon.invert = function(x, y) {
|
12
|
-
var λ = (λ = y / sqrtπ - 1) * λ;
|
13
|
-
return [
|
14
|
-
λ > 0 ? x * Math.sqrt(π / λ) / 2 : 0,
|
15
|
-
asin(1 - λ)
|
16
|
-
];
|
17
|
-
};
|
18
|
-
|
19
|
-
(d3.geo.collignon = function() { return projection(collignon); }).raw = collignon;
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
import "parallel1";
|
3
|
-
|
4
|
-
function craig(φ0) {
|
5
|
-
var tanφ0 = Math.tan(φ0);
|
6
|
-
|
7
|
-
function forward(λ, φ) {
|
8
|
-
return [
|
9
|
-
λ,
|
10
|
-
(λ ? λ / Math.sin(λ) : 1) * (Math.sin(φ) * Math.cos(λ) - tanφ0 * Math.cos(φ))
|
11
|
-
];
|
12
|
-
}
|
13
|
-
|
14
|
-
forward.invert = tanφ0 ? function(x, y) {
|
15
|
-
if (x) y *= Math.sin(x) / x;
|
16
|
-
var cosλ = Math.cos(x);
|
17
|
-
return [
|
18
|
-
x,
|
19
|
-
2 * Math.atan2(Math.sqrt(cosλ * cosλ + tanφ0 * tanφ0 - y * y) - cosλ, tanφ0 - y)
|
20
|
-
];
|
21
|
-
} : function(x, y) {
|
22
|
-
return [
|
23
|
-
x,
|
24
|
-
asin(x ? y * Math.tan(x) / x : y)
|
25
|
-
];
|
26
|
-
};
|
27
|
-
|
28
|
-
return forward;
|
29
|
-
}
|
30
|
-
|
31
|
-
(d3.geo.craig = function() { return parallel1Projection(craig); }).raw = craig;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function craster(λ, φ) {
|
4
|
-
var sqrt3 = Math.sqrt(3);
|
5
|
-
return [
|
6
|
-
sqrt3 * λ * (2 * Math.cos(2 * φ / 3) - 1) / sqrtπ,
|
7
|
-
sqrt3 * sqrtπ * Math.sin(φ / 3)
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
craster.invert = function(x, y) {
|
12
|
-
var sqrt3 = Math.sqrt(3),
|
13
|
-
φ = 3 * asin(y / (sqrt3 * sqrtπ));
|
14
|
-
return [
|
15
|
-
sqrtπ * x / (sqrt3 * (2 * Math.cos(2 * φ / 3) - 1)),
|
16
|
-
φ
|
17
|
-
];
|
18
|
-
};
|
19
|
-
|
20
|
-
(d3.geo.craster = function() { return projection(craster); }).raw = craster;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
import "parallel1";
|
3
|
-
|
4
|
-
function cylindricalEqualArea(φ0) {
|
5
|
-
var cosφ0 = Math.cos(φ0);
|
6
|
-
|
7
|
-
function forward(λ, φ) {
|
8
|
-
return [
|
9
|
-
λ * cosφ0,
|
10
|
-
Math.sin(φ) / cosφ0
|
11
|
-
];
|
12
|
-
}
|
13
|
-
|
14
|
-
forward.invert = function(x, y) {
|
15
|
-
return [
|
16
|
-
x / cosφ0,
|
17
|
-
asin(y * cosφ0)
|
18
|
-
];
|
19
|
-
};
|
20
|
-
|
21
|
-
return forward;
|
22
|
-
}
|
23
|
-
|
24
|
-
(d3.geo.cylindricalEqualArea = function() { return parallel1Projection(cylindricalEqualArea); }).raw = cylindricalEqualArea;
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert1(λ, φ) {
|
4
|
-
var α = Math.sqrt(8 / (3 * π));
|
5
|
-
return [
|
6
|
-
α * λ * (1 - Math.abs(φ) / π),
|
7
|
-
α * φ
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
eckert1.invert = function(x, y) {
|
12
|
-
var α = Math.sqrt(8 / (3 * π)),
|
13
|
-
φ = y / α;
|
14
|
-
return [
|
15
|
-
x / (α * (1 - Math.abs(φ) / π)),
|
16
|
-
φ
|
17
|
-
];
|
18
|
-
};
|
19
|
-
|
20
|
-
(d3.geo.eckert1 = function() { return projection(eckert1); }).raw = eckert1;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert2(λ, φ) {
|
4
|
-
var α = Math.sqrt(4 - 3 * Math.sin(Math.abs(φ)));
|
5
|
-
return [
|
6
|
-
2 / Math.sqrt(6 * π) * λ * α,
|
7
|
-
sgn(φ) * Math.sqrt(2 * π / 3) * (2 - α)
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
eckert2.invert = function(x, y) {
|
12
|
-
var α = 2 - Math.abs(y) / Math.sqrt(2 * π / 3);
|
13
|
-
return [
|
14
|
-
x * Math.sqrt(6 * π) / (2 * α),
|
15
|
-
sgn(y) * asin((4 - α * α) / 3)
|
16
|
-
];
|
17
|
-
};
|
18
|
-
|
19
|
-
(d3.geo.eckert2 = function() { return projection(eckert2); }).raw = eckert2;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert3(λ, φ) {
|
4
|
-
var k = Math.sqrt(π * (4 + π));
|
5
|
-
return [
|
6
|
-
2 / k * λ * (1 + Math.sqrt(1 - 4 * φ * φ / (π * π))),
|
7
|
-
4 / k * φ
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
eckert3.invert = function(x, y) {
|
12
|
-
var k = Math.sqrt(π * (4 + π)) / 2;
|
13
|
-
return [
|
14
|
-
x * k / (1 + asqrt(1 - y * y * (4 + π) / (4 * π))),
|
15
|
-
y * k / 2
|
16
|
-
];
|
17
|
-
};
|
18
|
-
|
19
|
-
(d3.geo.eckert3 = function() { return projection(eckert3); }).raw = eckert3;
|
@@ -1,26 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert4(λ, φ) {
|
4
|
-
var k = (2 + π / 2) * Math.sin(φ);
|
5
|
-
φ /= 2;
|
6
|
-
for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) {
|
7
|
-
var cosφ = Math.cos(φ);
|
8
|
-
φ -= δ = (φ + Math.sin(φ) * (cosφ + 2) - k) / (2 * cosφ * (1 + cosφ));
|
9
|
-
}
|
10
|
-
return [
|
11
|
-
2 / Math.sqrt(π * (4 + π)) * λ * (1 + Math.cos(φ)),
|
12
|
-
2 * Math.sqrt(π / (4 + π)) * Math.sin(φ)
|
13
|
-
];
|
14
|
-
}
|
15
|
-
|
16
|
-
eckert4.invert = function(x, y) {
|
17
|
-
var A = .5 * y * Math.sqrt((4 + π) / π),
|
18
|
-
k = asin(A),
|
19
|
-
c = Math.cos(k);
|
20
|
-
return [
|
21
|
-
x / (2 / Math.sqrt(π * (4 + π)) * (1 + c)),
|
22
|
-
asin((k + A * (c + 2)) / (2 + π / 2))
|
23
|
-
];
|
24
|
-
};
|
25
|
-
|
26
|
-
(d3.geo.eckert4 = function() { return projection(eckert4); }).raw = eckert4;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert5(λ, φ) {
|
4
|
-
return [
|
5
|
-
λ * (1 + Math.cos(φ)) / Math.sqrt(2 + π),
|
6
|
-
2 * φ / Math.sqrt(2 + π)
|
7
|
-
];
|
8
|
-
}
|
9
|
-
|
10
|
-
eckert5.invert = function(x, y) {
|
11
|
-
var k = Math.sqrt(2 + π),
|
12
|
-
φ = y * k / 2;
|
13
|
-
return [
|
14
|
-
k * x / (1 + Math.cos(φ)),
|
15
|
-
φ
|
16
|
-
];
|
17
|
-
};
|
18
|
-
|
19
|
-
(d3.geo.eckert5 = function() { return projection(eckert5); }).raw = eckert5;
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function eckert6(λ, φ) {
|
4
|
-
var k = (1 + π / 2) * Math.sin(φ);
|
5
|
-
for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) {
|
6
|
-
φ -= δ = (φ + Math.sin(φ) - k) / (1 + Math.cos(φ));
|
7
|
-
}
|
8
|
-
k = Math.sqrt(2 + π);
|
9
|
-
return [
|
10
|
-
λ * (1 + Math.cos(φ)) / k,
|
11
|
-
2 * φ / k
|
12
|
-
];
|
13
|
-
}
|
14
|
-
|
15
|
-
eckert6.invert = function(x, y) {
|
16
|
-
var j = 1 + π / 2,
|
17
|
-
k = Math.sqrt(j / 2);
|
18
|
-
return [
|
19
|
-
x * 2 * k / (1 + Math.cos(y *= k)),
|
20
|
-
asin((y + Math.sin(y)) / j)
|
21
|
-
];
|
22
|
-
};
|
23
|
-
|
24
|
-
(d3.geo.eckert6 = function() { return projection(eckert6); }).raw = eckert6;
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
import "august";
|
3
|
-
|
4
|
-
function eisenlohr(λ, φ) {
|
5
|
-
var s0 = Math.sin(λ /= 2),
|
6
|
-
c0 = Math.cos(λ),
|
7
|
-
k = Math.sqrt(Math.cos(φ)),
|
8
|
-
c1 = Math.cos(φ /= 2),
|
9
|
-
t = Math.sin(φ) / (c1 + Math.SQRT2 * c0 * k),
|
10
|
-
c = Math.sqrt(2 / (1 + t * t)),
|
11
|
-
v = Math.sqrt((Math.SQRT2 * c1 + (c0 + s0) * k) / (Math.SQRT2 * c1 + (c0 - s0) * k));
|
12
|
-
return [
|
13
|
-
eisenlohrK * (c * (v - 1 / v) - 2 * Math.log(v)),
|
14
|
-
eisenlohrK * (c * t * (v + 1 / v) - 2 * Math.atan(t))
|
15
|
-
];
|
16
|
-
}
|
17
|
-
|
18
|
-
eisenlohr.invert = function(x, y) {
|
19
|
-
var p = d3.geo.august.raw.invert(x / 1.2, y * 1.065);
|
20
|
-
if (!p) return null;
|
21
|
-
var λ = p[0],
|
22
|
-
φ = p[1],
|
23
|
-
i = 20;
|
24
|
-
x /= eisenlohrK, y /= eisenlohrK;
|
25
|
-
do {
|
26
|
-
var _0 = λ / 2,
|
27
|
-
_1 = φ / 2,
|
28
|
-
s0 = Math.sin(_0),
|
29
|
-
c0 = Math.cos(_0),
|
30
|
-
s1 = Math.sin(_1),
|
31
|
-
c1 = Math.cos(_1),
|
32
|
-
cos1 = Math.cos(φ),
|
33
|
-
|
34
|
-
k = Math.sqrt(cos1),
|
35
|
-
t = s1 / (c1 + Math.SQRT2 * c0 * k),
|
36
|
-
t2 = t * t,
|
37
|
-
c = Math.sqrt(2 / (1 + t2)),
|
38
|
-
v0 = (Math.SQRT2 * c1 + (c0 + s0) * k),
|
39
|
-
v1 = (Math.SQRT2 * c1 + (c0 - s0) * k),
|
40
|
-
v2 = v0 / v1,
|
41
|
-
v = Math.sqrt(v2),
|
42
|
-
vm1v = v - 1 / v,
|
43
|
-
vp1v = v + 1 / v,
|
44
|
-
|
45
|
-
fx = c * vm1v - 2 * Math.log(v) - x,
|
46
|
-
fy = c * t * vp1v - 2 * Math.atan(t) - y,
|
47
|
-
|
48
|
-
δtδλ = s1 && Math.SQRT1_2 * k * s0 * t2 / s1,
|
49
|
-
δtδφ = (Math.SQRT2 * c0 * c1 + k) / (2 * (c1 + Math.SQRT2 * c0 * k) * (c1 + Math.SQRT2 * c0 * k) * k),
|
50
|
-
|
51
|
-
δcδt = -.5 * t * c * c * c,
|
52
|
-
δcδλ = δcδt * δtδλ,
|
53
|
-
δcδφ = δcδt * δtδφ,
|
54
|
-
|
55
|
-
A = (A = 2 * c1 + Math.SQRT2 * k * (c0 - s0)) * A * v,
|
56
|
-
δvδλ = (Math.SQRT2 * c0 * c1 * k + cos1) / A,
|
57
|
-
δvδφ = -(Math.SQRT2 * s0 * s1) / (k * A),
|
58
|
-
|
59
|
-
δxδλ = vm1v * δcδλ - 2 * δvδλ / v + c * (δvδλ + δvδλ / v2),
|
60
|
-
δxδφ = vm1v * δcδφ - 2 * δvδφ / v + c * (δvδφ + δvδφ / v2),
|
61
|
-
δyδλ = t * vp1v * δcδλ - 2 * δtδλ / (1 + t2) + c * vp1v * δtδλ + c * t * (δvδλ - δvδλ / v2),
|
62
|
-
δyδφ = t * vp1v * δcδφ - 2 * δtδφ / (1 + t2) + c * vp1v * δtδφ + c * t * (δvδφ - δvδφ / v2),
|
63
|
-
|
64
|
-
denominator = δxδφ * δyδλ - δyδφ * δxδλ;
|
65
|
-
if (!denominator) break;
|
66
|
-
var δλ = (fy * δxδφ - fx * δyδφ) / denominator,
|
67
|
-
δφ = (fx * δyδλ - fy * δxδλ) / denominator;
|
68
|
-
λ -= δλ;
|
69
|
-
φ = Math.max(-π / 2, Math.min(π / 2, φ - δφ));
|
70
|
-
} while ((Math.abs(δλ) > ε || Math.abs(δφ) > ε) && --i > 0);
|
71
|
-
return Math.abs(Math.abs(φ) - π / 2) < ε
|
72
|
-
? [0, φ]
|
73
|
-
: i && [λ, φ];
|
74
|
-
};
|
75
|
-
|
76
|
-
var eisenlohrK = 3 + 2 * Math.SQRT2;
|
77
|
-
|
78
|
-
(d3.geo.eisenlohr = function() { return projection(eisenlohr); }).raw = eisenlohr;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import "math";
|
2
|
-
import "hyperbolic";
|
3
|
-
|
4
|
-
// Returns [sn, cn, dn](u + iv|m).
|
5
|
-
function ellipticJi(u, v, m) {
|
6
|
-
if (!u) {
|
7
|
-
var b = ellipticJ(v, 1 - m);
|
8
|
-
return [
|
9
|
-
[0, b[0] / b[1]],
|
10
|
-
[1 / b[1], 0],
|
11
|
-
[b[2] / b[1], 0]
|
12
|
-
];
|
13
|
-
}
|
14
|
-
var a = ellipticJ(u, m);
|
15
|
-
if (!v) return [[a[0], 0], [a[1], 0], [a[2], 0]];
|
16
|
-
var b = ellipticJ(v, 1 - m),
|
17
|
-
denominator = b[1] * b[1] + m * a[0] * a[0] * b[0] * b[0];
|
18
|
-
return [
|
19
|
-
[a[0] * b[2] / denominator, a[1] * a[2] * b[0] * b[1] / denominator],
|
20
|
-
[a[1] * b[1] / denominator, -a[0] * a[2] * b[0] * b[2] / denominator],
|
21
|
-
[a[2] * b[1] * b[2] / denominator, -m * a[0] * a[1] * b[0] / denominator]
|
22
|
-
];
|
23
|
-
}
|
24
|
-
|
25
|
-
// Returns [sn, cn, dn, ph](u|m).
|
26
|
-
function ellipticJ(u, m) {
|
27
|
-
var ai, b, φ, t, twon;
|
28
|
-
if (m < ε) {
|
29
|
-
t = Math.sin(u);
|
30
|
-
b = Math.cos(u);
|
31
|
-
ai = .25 * m * (u - t * b);
|
32
|
-
return [
|
33
|
-
t - ai * b,
|
34
|
-
b + ai * t,
|
35
|
-
1 - .5 * m * t * t,
|
36
|
-
u - ai
|
37
|
-
];
|
38
|
-
}
|
39
|
-
if (m >= 1 - ε) {
|
40
|
-
ai = .25 * (1 - m);
|
41
|
-
b = cosh(u);
|
42
|
-
t = tanh(u);
|
43
|
-
φ = 1 / b;
|
44
|
-
twon = b * sinh(u);
|
45
|
-
return [
|
46
|
-
t + ai * (twon - u) / (b * b),
|
47
|
-
φ - ai * t * φ * (twon - u),
|
48
|
-
φ + ai * t * φ * (twon + u),
|
49
|
-
2 * Math.atan(Math.exp(u)) - π / 2 + ai * (twon - u) / b
|
50
|
-
];
|
51
|
-
}
|
52
|
-
|
53
|
-
var a = [1, 0, 0, 0, 0, 0, 0, 0, 0],
|
54
|
-
c = [Math.sqrt(m), 0, 0, 0, 0, 0, 0, 0, 0],
|
55
|
-
i = 0;
|
56
|
-
b = Math.sqrt(1 - m);
|
57
|
-
twon = 1;
|
58
|
-
|
59
|
-
while (Math.abs(c[i] / a[i]) > ε && i < 8) {
|
60
|
-
ai = a[i++];
|
61
|
-
c[i] = .5 * (ai - b);
|
62
|
-
a[i] = .5 * (ai + b);
|
63
|
-
b = asqrt(ai * b);
|
64
|
-
twon *= 2;
|
65
|
-
}
|
66
|
-
|
67
|
-
φ = twon * a[i] * u;
|
68
|
-
do {
|
69
|
-
t = c[i] * Math.sin(b = φ) / a[i];
|
70
|
-
φ = .5 * (asin(t) + φ);
|
71
|
-
} while (--i);
|
72
|
-
|
73
|
-
return [Math.sin(φ), t = Math.cos(φ), t / Math.cos(φ - b), φ];
|
74
|
-
}
|
75
|
-
|
76
|
-
// Calculate F(φ+iψ|m).
|
77
|
-
// See Abramowitz and Stegun, 17.4.11.
|
78
|
-
function ellipticFi(φ, ψ, m) {
|
79
|
-
var r = Math.abs(φ),
|
80
|
-
i = Math.abs(ψ),
|
81
|
-
sinhψ = sinh(i);
|
82
|
-
if (r) {
|
83
|
-
var cscφ = 1 / Math.sin(r),
|
84
|
-
cotφ2 = 1 / (Math.tan(r) * Math.tan(r)),
|
85
|
-
b = -(cotφ2 + m * (sinhψ * sinhψ * cscφ * cscφ) - 1 + m),
|
86
|
-
c = (m - 1) * cotφ2,
|
87
|
-
cotλ2 = .5 * (-b + Math.sqrt(b * b - 4 * c));
|
88
|
-
return [
|
89
|
-
ellipticF(Math.atan(1 / Math.sqrt(cotλ2)), m) * sgn(φ),
|
90
|
-
ellipticF(Math.atan(asqrt((cotλ2 / cotφ2 - 1) / m)), 1 - m) * sgn(ψ)
|
91
|
-
];
|
92
|
-
}
|
93
|
-
return [
|
94
|
-
0,
|
95
|
-
ellipticF(Math.atan(sinhψ), 1 - m) * sgn(ψ)
|
96
|
-
];
|
97
|
-
}
|
98
|
-
|
99
|
-
// Calculate F(φ|m) where m = k² = sin²α.
|
100
|
-
// See Abramowitz and Stegun, 17.6.7.
|
101
|
-
function ellipticF(φ, m) {
|
102
|
-
if (!m) return φ;
|
103
|
-
if (m === 1) return Math.log(Math.tan(φ / 2 + π / 4));
|
104
|
-
var a = 1,
|
105
|
-
b = Math.sqrt(1 - m),
|
106
|
-
c = Math.sqrt(m);
|
107
|
-
for (var i = 0; Math.abs(c) > ε; i++) {
|
108
|
-
if (φ % π) {
|
109
|
-
var dφ = Math.atan(b * Math.tan(φ) / a);
|
110
|
-
if (dφ < 0) dφ += π;
|
111
|
-
φ += dφ + ~~(φ / π) * π;
|
112
|
-
} else φ += φ;
|
113
|
-
c = (a + b) / 2;
|
114
|
-
b = Math.sqrt(a * b);
|
115
|
-
c = ((a = c) - b) / 2;
|
116
|
-
}
|
117
|
-
return φ / (Math.pow(2, i) * a);
|
118
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
})();
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function fahey(λ, φ) {
|
4
|
-
var t = Math.tan(φ / 2);
|
5
|
-
return [
|
6
|
-
λ * faheyK * asqrt(1 - t * t),
|
7
|
-
(1 + faheyK) * t
|
8
|
-
];
|
9
|
-
}
|
10
|
-
|
11
|
-
fahey.invert = function(x, y) {
|
12
|
-
var t = y / (1 + faheyK);
|
13
|
-
return [
|
14
|
-
x ? x / (faheyK * asqrt(1 - t * t)) : 0,
|
15
|
-
2 * Math.atan(t)
|
16
|
-
];
|
17
|
-
};
|
18
|
-
|
19
|
-
var faheyK = Math.cos(35 * radians);
|
20
|
-
|
21
|
-
(d3.geo.fahey = function() { return projection(fahey); }).raw = fahey;
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import "projection";
|
2
|
-
|
3
|
-
function gallStereographic(λ, φ) {
|
4
|
-
return [
|
5
|
-
λ * Math.SQRT1_2,
|
6
|
-
(1 + Math.SQRT1_2) * Math.tan(φ / 2)
|
7
|
-
];
|
8
|
-
}
|
9
|
-
|
10
|
-
gallStereographic.invert = function(x, y) {
|
11
|
-
return [
|
12
|
-
x * Math.SQRT2,
|
13
|
-
Math.atan(y / (1 + Math.SQRT1_2)) * 2
|
14
|
-
];
|
15
|
-
};
|
16
|
-
|
17
|
-
(d3.geo.gallStereographic = function() {
|
18
|
-
return projection(gallStereographic);
|
19
|
-
}).raw = gallStereographic;
|
@@ -1,56 +0,0 @@
|
|
1
|
-
import "math";
|
2
|
-
|
3
|
-
function ginzburgPolyconic(a, b, c, d, e, f, g, h) {
|
4
|
-
if (arguments.length < 8) h = 0;
|
5
|
-
|
6
|
-
function forward(λ, φ) {
|
7
|
-
if (!φ) return [a * λ / π, 0];
|
8
|
-
var φ2 = φ * φ,
|
9
|
-
xB = a + φ2 * (b + φ2 * (c + φ2 * d)),
|
10
|
-
yB = φ * (e - 1 + φ2 * (f - h + φ2 * g)),
|
11
|
-
m = (xB * xB + yB * yB) / (2 * yB),
|
12
|
-
α = λ * Math.asin(xB / m) / π;
|
13
|
-
return [m * Math.sin(α), φ * (1 + φ2 * h) + m * (1 - Math.cos(α))];
|
14
|
-
}
|
15
|
-
|
16
|
-
forward.invert = function(x, y) {
|
17
|
-
var λ = π * x / a,
|
18
|
-
φ = y,
|
19
|
-
δλ, δφ, i = 50;
|
20
|
-
do {
|
21
|
-
var φ2 = φ * φ,
|
22
|
-
xB = a + φ2 * (b + φ2 * (c + φ2 * d)),
|
23
|
-
yB = φ * (e - 1 + φ2 * (f - h + φ2 * g)),
|
24
|
-
p = xB * xB + yB * yB,
|
25
|
-
q = 2 * yB,
|
26
|
-
m = p / q,
|
27
|
-
m2 = m * m,
|
28
|
-
dαdλ = Math.asin(xB / m) / π,
|
29
|
-
α = λ * dαdλ;
|
30
|
-
xB2 = xB * xB,
|
31
|
-
dxBdφ = (2 * b + φ2 * (4 * c + φ2 * 6 * d)) * φ,
|
32
|
-
dyBdφ = e + φ2 * (3 * f + φ2 * 5 * g),
|
33
|
-
dpdφ = 2 * (xB * dxBdφ + yB * (dyBdφ - 1)),
|
34
|
-
dqdφ = 2 * (dyBdφ - 1),
|
35
|
-
dmdφ = (dpdφ * q - p * dqdφ) / (q * q),
|
36
|
-
cosα = Math.cos(α),
|
37
|
-
sinα = Math.sin(α),
|
38
|
-
mcosα = m * cosα,
|
39
|
-
msinα = m * sinα,
|
40
|
-
dαdφ = ((λ / π) * (1 / asqrt(1 - xB2 / m2)) * (dxBdφ * m - xB * dmdφ)) / m2,
|
41
|
-
fx = msinα - x,
|
42
|
-
fy = φ * (1 + φ2 * h) + m - mcosα - y,
|
43
|
-
δxδφ = dmdφ * sinα + mcosα * dαdφ,
|
44
|
-
δxδλ = mcosα * dαdλ,
|
45
|
-
δyδφ = 1 + dmdφ - (dmdφ * cosα - msinα * dαdφ),
|
46
|
-
δyδλ = msinα * dαdλ,
|
47
|
-
denominator = δxδφ * δyδλ - δyδφ * δxδλ;
|
48
|
-
if (!denominator) break;
|
49
|
-
λ -= δλ = (fy * δxδφ - fx * δyδφ) / denominator;
|
50
|
-
φ -= δφ = (fx * δyδλ - fy * δxδλ) / denominator;
|
51
|
-
} while ((Math.abs(δλ) > ε || Math.abs(δφ) > ε) && --i > 0);
|
52
|
-
return [λ, φ];
|
53
|
-
};
|
54
|
-
|
55
|
-
return forward;
|
56
|
-
}
|