raw = {
const rawLee = d3
.geoTetrahedralLee()
.rotate(rotate)
.fitExtent([[-4, -1.5 / sqrt3_4], [4, 1.5 / sqrt3_4]], {
type: "Sphere"
});
const forward = (l, p) => {
let [x, y] = rawLee([l * degrees, p * degrees]);
y = -y;
if (x < -2.1 || y < -2.73) {
x = -x - 4;
y = -y;
}
if (x < -4) {
x = -x - 8;
y = 6.93 - y;
}
return [x, y];
};
forward.invert = (x, y) => {
y = -y;
const a =
rawLee.invert([x, y]) ||
rawLee.invert([-x - 4, -y]) ||
rawLee.invert([-x - 8, 6.93 - y]) ||
rawLee.invert([-(-x - 8) - 4, 6.93 + y]);
if (a) return [a[0] * radians, a[1] * radians];
};
return forward;
}