You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
589 B
26 lines
589 B
import {geoProjection as projection} from "d3-geo";
|
|
import {abs, cos, epsilon, tan} from "./math.js";
|
|
|
|
export function nellHammerRaw(lambda, phi) {
|
|
return [
|
|
lambda * (1 + cos(phi)) / 2,
|
|
2 * (phi - tan(phi / 2))
|
|
];
|
|
}
|
|
|
|
nellHammerRaw.invert = function(x, y) {
|
|
var p = y / 2;
|
|
for (var i = 0, delta = Infinity; i < 10 && abs(delta) > epsilon; ++i) {
|
|
var c = cos(y / 2);
|
|
y -= delta = (y - tan(y / 2) - p) / (1 - 0.5 / (c * c));
|
|
}
|
|
return [
|
|
2 * x / (1 + cos(y)),
|
|
y
|
|
];
|
|
};
|
|
|
|
export default function() {
|
|
return projection(nellHammerRaw)
|
|
.scale(152.63);
|
|
}
|
|
|