Fix albers tests and inversion of North pole.

This commit is contained in:
Jason Davies 2013-05-20 13:23:59 +01:00
Родитель 1bdc29928d
Коммит af35ec07ff
5 изменённых файлов: 16 добавлений и 14 удалений

2
d3.js поставляемый
Просмотреть файл

@ -3352,7 +3352,7 @@ d3 = function() {
}
forward.invert = function(x, y) {
var ρ0_y = ρ0 - y;
return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
};
return forward;
}

2
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -21,7 +21,7 @@ function d3_geo_conicEqualArea(φ0, φ1) {
var ρ0_y = ρ0 - y;
return [
Math.atan2(x, ρ0_y) / n,
Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))
d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))
];
};

Просмотреть файл

@ -13,24 +13,26 @@ suite.addBatch({
"has the parallels 29.5°, 45.5°": function(p) {
assert.inDelta(p.parallels(), [29.5, 45.5], 1e-6);
},
"has the rotation 98°, 0°": function(p) {
assert.inDelta(p.rotate(), [98, 0, 0], 1e-6);
"has the rotation 96°, 0°": function(p) {
assert.inDelta(p.rotate(), [96, 0, 0], 1e-6);
},
"has the center 0°, 38°": function(p) {
assert.inDelta(p.center(), [0, 38], 1e-6);
"has the center -0.6°, 38.7°": function(p) {
assert.inDelta(p.center(), [-.6, 38.7], 1e-6);
},
"has the scale 1000": function(p) {
assert.inDelta(p.scale(), 1000, 1e-6);
"has the scale 1070": function(p) {
assert.inDelta(p.scale(), 1070, 1e-6);
}
}, {
"Washington, DC": [[-120.50000000, 47.50000000], [ 215.47899724, 51.97649392]],
"San Francisco, CA": [[-122.42000000, 37.78000000], [ 150.07267740, 211.25782936]]
"Washington, DC": [[-120.50000000, 47.50000000], [ 181.00023857, 45.12748866]],
"San Francisco, CA": [[-122.42000000, 37.78000000], [ 107.44485839, 214.04820561]],
"the North Pole": [[ 0.00000000, 90.00000000], [1062.11670525, -761.71949818]]
}),
"translated to 0,0 and at scale 1": projectionTestSuite({
topic: function(projection) { return projection().translate([0, 0]).scale(1); }
}, {
"Washington, DC": [[-120.50000000, 47.50000000], [ -0.26452100, -0.19802351]],
"San Francisco, CA": [[-122.42000000, 37.78000000], [ -0.32992732, -0.03874217]]
"Washington, DC": [[-120.50000000, 47.50000000], [ -0.27943903, -0.19146964]],
"San Francisco, CA": [[-122.42000000, 37.78000000], [ -0.34818238, -0.03359981]],
"the North Pole": [[ 0.00000000, 90.00000000], [ 0.54403430, -0.94553224]]
})
}
});

Просмотреть файл

@ -30,7 +30,7 @@ suite.addBatch({
"Tierra del Fuego": [[ -35.62300462, -60.29317484], [ -0.81309535, 0.63745721]],
"Tokyo": [[ 33.38709832, 79.49539834], [ 0.22216975, -1.44766929]],
"the South Pole": [[ 0.00000000, -85.00000000], [ 0.00000000, 0.84251256]],
"the North Pole": [[ 0.00000000, 85.00000000], [ 0.00000000, -1.45376849]]
"the North Pole": [[ 0.00000000, 90.00000000], [ 0.00000000, -1.46410162]]
})
}
});