Skip to content

Commit af35ec0

Browse files
committed
Fix albers tests and inversion of North pole.
1 parent 1bdc299 commit af35ec0

5 files changed

Lines changed: 16 additions & 14 deletions

File tree

d3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3352,7 +3352,7 @@ d3 = function() {
33523352
}
33533353
forward.invert = function(x, y) {
33543354
var ρ0_y = ρ0 - y;
3355-
return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
3355+
return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
33563356
};
33573357
return forward;
33583358
}

d3.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/geo/conic-equal-area.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function d3_geo_conicEqualArea(φ0, φ1) {
2121
var ρ0_y = ρ0 - y;
2222
return [
2323
Math.atan2(x, ρ0_y) / n,
24-
Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))
24+
d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))
2525
];
2626
};
2727

test/geo/albers-test.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,26 @@ suite.addBatch({
1313
"has the parallels 29.5°, 45.5°": function(p) {
1414
assert.inDelta(p.parallels(), [29.5, 45.5], 1e-6);
1515
},
16-
"has the rotation 98°, 0°": function(p) {
17-
assert.inDelta(p.rotate(), [98, 0, 0], 1e-6);
16+
"has the rotation 96°, 0°": function(p) {
17+
assert.inDelta(p.rotate(), [96, 0, 0], 1e-6);
1818
},
19-
"has the center 0°, 38°": function(p) {
20-
assert.inDelta(p.center(), [0, 38], 1e-6);
19+
"has the center -0.6°, 38.7°": function(p) {
20+
assert.inDelta(p.center(), [-.6, 38.7], 1e-6);
2121
},
22-
"has the scale 1000": function(p) {
23-
assert.inDelta(p.scale(), 1000, 1e-6);
22+
"has the scale 1070": function(p) {
23+
assert.inDelta(p.scale(), 1070, 1e-6);
2424
}
2525
}, {
26-
"Washington, DC": [[-120.50000000, 47.50000000], [ 215.47899724, 51.97649392]],
27-
"San Francisco, CA": [[-122.42000000, 37.78000000], [ 150.07267740, 211.25782936]]
26+
"Washington, DC": [[-120.50000000, 47.50000000], [ 181.00023857, 45.12748866]],
27+
"San Francisco, CA": [[-122.42000000, 37.78000000], [ 107.44485839, 214.04820561]],
28+
"the North Pole": [[ 0.00000000, 90.00000000], [1062.11670525, -761.71949818]]
2829
}),
2930
"translated to 0,0 and at scale 1": projectionTestSuite({
3031
topic: function(projection) { return projection().translate([0, 0]).scale(1); }
3132
}, {
32-
"Washington, DC": [[-120.50000000, 47.50000000], [ -0.26452100, -0.19802351]],
33-
"San Francisco, CA": [[-122.42000000, 37.78000000], [ -0.32992732, -0.03874217]]
33+
"Washington, DC": [[-120.50000000, 47.50000000], [ -0.27943903, -0.19146964]],
34+
"San Francisco, CA": [[-122.42000000, 37.78000000], [ -0.34818238, -0.03359981]],
35+
"the North Pole": [[ 0.00000000, 90.00000000], [ 0.54403430, -0.94553224]]
3436
})
3537
}
3638
});

test/geo/conic-equal-area-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ suite.addBatch({
3030
"Tierra del Fuego": [[ -35.62300462, -60.29317484], [ -0.81309535, 0.63745721]],
3131
"Tokyo": [[ 33.38709832, 79.49539834], [ 0.22216975, -1.44766929]],
3232
"the South Pole": [[ 0.00000000, -85.00000000], [ 0.00000000, 0.84251256]],
33-
"the North Pole": [[ 0.00000000, 85.00000000], [ 0.00000000, -1.45376849]]
33+
"the North Pole": [[ 0.00000000, 90.00000000], [ 0.00000000, -1.46410162]]
3434
})
3535
}
3636
});

0 commit comments

Comments
 (0)