{
const svg = d3.select(DOM.svg(size + margin * 2, size + margin * 2));
const g = svg.append("g")
.attr("transform", `translate(${margin}, ${margin})`);
const projection = d3.geoOrthographic()
.fitSize([size, size], {type: "Sphere"});
const path = d3.geoPath()
.projection(projection);
const circle = d3.geoCircle()
.center(d => d)
.radius(1);
const graticule = g.append("path")
.datum(d3.geoGraticule()())
.attr("class", "graticule");
const sphere = g.append("path")
.datum({type: "Sphere"})
.attr("class", "sphere");
const points = g.selectAll(".point")
.data([a, b])
.enter().append("path")
.attr("class", "point");
const line = g.append("path")
.datum(geoLine(a, b))
.attr("class", "line");
const swoop = g.append("path")
.datum(geoSwoop(a, b, offset))
.attr("class", "swoop");
function update(){
graticule.attr("d", path);
sphere.attr("d", path);
line.attr("d", path);
swoop.attr("d", path);
points.attr("d", d => path(circle(d)));
}
update();
d3.geoInertiaDrag(svg, update, projection);
return svg.node();
}