No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

27 líneas
856 B

  1. import {geoInterpolate as interpolate, geoProjection as projection, geoRotation as rotation} from "d3-geo";
  2. import {asin, degrees, pi, sin, radians} from "./math.js";
  3. // Compute the origin as the midpoint of the two reference points.
  4. // Rotate one of the reference points by the origin.
  5. // Apply the spherical law of sines to compute gamma rotation.
  6. export default function(raw, p0, p1) {
  7. var i = interpolate(p0, p1),
  8. o = i(0.5),
  9. a = rotation([-o[0], -o[1]])(p0),
  10. b = i.distance / 2,
  11. y = -asin(sin(a[1] * radians) / sin(b)),
  12. R = [-o[0], -o[1], -(a[0] > 0 ? pi - y : y) * degrees],
  13. p = projection(raw(b)).rotate(R),
  14. r = rotation(R),
  15. center = p.center;
  16. delete p.rotate;
  17. p.center = function(_) {
  18. return arguments.length ? center(r(_)) : r.invert(center());
  19. };
  20. return p
  21. .clipAngle(90);
  22. }