Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SMASH!

  • Loading branch information...
commit c6fef9f9c5ad4c716fc1a0e459f55168d3b53902 1 parent 0711bdf
@jasondavies jasondavies authored
Showing with 156 additions and 109 deletions.
  1. +9 −84 Makefile
  2. +2 −0  geo/projection/aitoff.js
  3. +2 −0  geo/projection/armadillo.js
  4. +2 −0  geo/projection/august.js
  5. +2 −0  geo/projection/baker.js
  6. +2 −0  geo/projection/berghaus.js
  7. +2 −1  geo/projection/boggs.js
  8. +3 −2 geo/projection/bonne.js
  9. +2 −1  geo/projection/bromley.js
  10. +2 −0  geo/projection/collignon.js
  11. +2 −1  geo/projection/conic-conformal.js
  12. +2 −1  geo/projection/conic-equal-area.js
  13. +2 −1  geo/projection/conic-equidistant.js
  14. +2 −1  geo/projection/craig.js
  15. +2 −0  geo/projection/craster.js
  16. +2 −1  geo/projection/cylindrical-equal-area.js
  17. +2 −0  geo/projection/eckert1.js
  18. +2 −0  geo/projection/eckert2.js
  19. +2 −0  geo/projection/eckert3.js
  20. +2 −0  geo/projection/eckert4.js
  21. +2 −0  geo/projection/eckert5.js
  22. +2 −0  geo/projection/eckert6.js
  23. +2 −1  geo/projection/eisenlohr.js
  24. +2 −0  geo/projection/elliptic.js
  25. +2 −0  geo/projection/fahey.js
  26. +2 −1  geo/projection/gringorten.js
  27. +3 −2 geo/projection/guyou.js
  28. +2 −0  geo/projection/hammer-retroazimuthal.js
  29. +2 −0  geo/projection/hammer.js
  30. +2 −0  geo/projection/hatano.js
  31. +2 −0  geo/projection/healpix.js
  32. +2 −0  geo/projection/hill.js
  33. +4 −3 geo/projection/homolosine.js
  34. +2 −0  geo/projection/interrupt.js
  35. +2 −0  geo/projection/kavrayskiy7.js
  36. +2 −0  geo/projection/lagrange.js
  37. +2 −0  geo/projection/larrivee.js
  38. +2 −0  geo/projection/laskowski.js
  39. +2 −0  geo/projection/littrow.js
  40. +2 −1  geo/projection/loximuthal.js
  41. +2 −0  geo/projection/miller.js
  42. +2 −0  geo/projection/modified-stereographic.js
  43. +2 −0  geo/projection/mollweide.js
  44. +2 −0  geo/projection/mt-flat-polar-parabolic.js
  45. +2 −0  geo/projection/mt-flat-polar-quartic.js
  46. +2 −0  geo/projection/mt-flat-polar-sinusoidal.js
  47. +2 −0  geo/projection/natural-earth.js
  48. +2 −0  geo/projection/nell-hammer.js
  49. +2 −0  geo/projection/parallel1.js
  50. +2 −0  geo/projection/parallel2.js
  51. +3 −2 geo/projection/peirce-quincuncial.js
  52. +2 −0  geo/projection/polyconic.js
  53. +2 −0  geo/projection/quincuncial.js
  54. +2 −1  geo/projection/rectangular-polyconic.js
  55. +2 −0  geo/projection/robinson.js
  56. +2 −0  geo/projection/satellite.js
  57. +3 −2 geo/projection/sinu-mollweide.js
  58. +2 −0  geo/projection/sinusoidal.js
  59. +2 −0  geo/projection/times.js
  60. +2 −0  geo/projection/transverse-mercator.js
  61. +2 −1  geo/projection/two-point-azimuthal.js
  62. +2 −0  geo/projection/two-point-equidistant.js
  63. +2 −0  geo/projection/van-der-grinten.js
  64. +2 −0  geo/projection/van-der-grinten2.js
  65. +2 −0  geo/projection/van-der-grinten3.js
  66. +2 −0  geo/projection/van-der-grinten4.js
  67. +2 −1  geo/projection/wagner4.js
  68. +2 −0  geo/projection/wagner6.js
  69. +2 −0  geo/projection/wagner7.js
  70. +2 −0  geo/projection/wiechel.js
  71. +2 −1  geo/projection/winkel3.js
  72. +1 −0  package.json
View
93 Makefile
@@ -2,94 +2,19 @@ all: \
d3.geo.projection.js \
d3.geo.projection.min.js
-d3.geo.projection.js: \
- geo/projection/start.js \
- geo/projection/projection.js \
- geo/projection/parallel1.js \
- geo/projection/parallel2.js \
- geo/projection/quincuncial.js \
- geo/projection/interrupt.js \
- geo/projection/elliptic.js \
- geo/projection/aitoff.js \
- geo/projection/guyou.js \
- geo/projection/mollweide.js \
- geo/projection/sinusoidal.js \
- geo/projection/sinu-mollweide.js \
- geo/projection/armadillo.js \
- geo/projection/august.js \
- geo/projection/baker.js \
- geo/projection/berghaus.js \
- geo/projection/boggs.js \
- geo/projection/bonne.js \
- geo/projection/bromley.js \
- geo/projection/collignon.js \
- geo/projection/conic-conformal.js \
- geo/projection/conic-equal-area.js \
- geo/projection/conic-equidistant.js \
- geo/projection/craig.js \
- geo/projection/craster.js \
- geo/projection/cylindrical-equal-area.js \
- geo/projection/eckert1.js \
- geo/projection/eckert2.js \
- geo/projection/eckert3.js \
- geo/projection/eckert4.js \
- geo/projection/eckert5.js \
- geo/projection/eckert6.js \
- geo/projection/eisenlohr.js \
- geo/projection/fahey.js \
- geo/projection/gringorten.js \
- geo/projection/hammer-retroazimuthal.js \
- geo/projection/hammer.js \
- geo/projection/hatano.js \
- geo/projection/healpix.js \
- geo/projection/hill.js \
- geo/projection/homolosine.js \
- geo/projection/kavrayskiy7.js \
- geo/projection/lagrange.js \
- geo/projection/larrivee.js \
- geo/projection/laskowski.js \
- geo/projection/littrow.js \
- geo/projection/loximuthal.js \
- geo/projection/miller.js \
- geo/projection/modified-stereographic.js \
- geo/projection/mt-flat-polar-parabolic.js \
- geo/projection/mt-flat-polar-quartic.js \
- geo/projection/mt-flat-polar-sinusoidal.js \
- geo/projection/natural-earth.js \
- geo/projection/nell-hammer.js \
- geo/projection/peirce-quincuncial.js \
- geo/projection/polyconic.js \
- geo/projection/rectangular-polyconic.js \
- geo/projection/robinson.js \
- geo/projection/satellite.js \
- geo/projection/times.js \
- geo/projection/transverse-mercator.js \
- geo/projection/two-point-azimuthal.js \
- geo/projection/two-point-equidistant.js \
- geo/projection/van-der-grinten.js \
- geo/projection/van-der-grinten2.js \
- geo/projection/van-der-grinten3.js \
- geo/projection/van-der-grinten4.js \
- geo/projection/wagner4.js \
- geo/projection/wagner6.js \
- geo/projection/wagner7.js \
- geo/projection/wiechel.js \
- geo/projection/winkel3.js \
- geo/projection/end.js
-
-test: all
- @node_modules/.bin/vows $(shell find . -name "*-test.js" \! -path "./node_modules/*")
-
-%.min.js: %.js Makefile
- @rm -f $@
- node_modules/.bin/uglifyjs $< -c -m -o $@
-
-d3%js: Makefile
+d3.geo.projection.js: $(shell node_modules/.bin/smash --list geo/projection/index.js)
@rm -f $@
- @cat $(filter %.js,$^) > $@.tmp
+ node_modules/.bin/smash geo/projection/index.js > $@.tmp
node_modules/.bin/uglifyjs $@.tmp -b indent-level=2 -o $@
@rm $@.tmp
@chmod a-w $@
+d3.geo.projection.min.js: d3.geo.projection.js
+ @rm -f $@
+ node_modules/.bin/uglifyjs $< -c -m -o $@
+
+test: all
+ @node_modules/.bin/vows $(shell find . -name "*-test.js" \! -path "./node_modules/*")
+
clean:
rm -f d3.*.js
View
2  geo/projection/aitoff.js
@@ -1,3 +1,5 @@
+import "projection";
+
function aitoff(λ, φ) {
var cosφ = Math.cos(φ),
sinciα = sinci(acos(cosφ * Math.cos/= 2)));
View
2  geo/projection/armadillo.js
@@ -1,3 +1,5 @@
+import "projection";
+
function armadillo(φ0) {
var sinφ0 = Math.sin0),
cosφ0 = Math.cos0),
View
2  geo/projection/august.js
@@ -1,3 +1,5 @@
+import "projection";
+
function august(λ, φ) {
var tanφ = Math.tan(φ / 2),
k = asqrt(1 - tanφ * tanφ),
View
2  geo/projection/baker.js
@@ -1,3 +1,5 @@
+import "projection";
+
var bakerφ = Math.log(1 + Math.SQRT2);
function baker(λ, φ) {
View
2  geo/projection/berghaus.js
@@ -1,3 +1,5 @@
+import "projection";
+
var berghausAzimuthalEquidistant = d3.geo.azimuthalEquidistant.raw;
function berghaus(n) {
View
3  geo/projection/boggs.js
@@ -1,4 +1,5 @@
-// @import mollweide
+import "projection";
+import "mollweide";
function boggs(λ, φ) {
var k = 2.00276,
View
5 geo/projection/bonne.js
@@ -1,5 +1,6 @@
-// @import parallel1
-// @import sinusoidal
+import "projection";
+import "parallel1";
+import "sinusoidal";
function bonne(φ0) {
if (!φ0) return sinusoidal;
View
3  geo/projection/bromley.js
@@ -1,4 +1,5 @@
-// @import mollweide
+import "projection";
+import "mollweide";
var bromley = mollweideBromley(1, 4 / π, π);
View
2  geo/projection/collignon.js
@@ -1,3 +1,5 @@
+import "projection";
+
function collignon(λ, φ) {
var α = asqrt(1 - Math.sin(φ));
return [
View
3  geo/projection/conic-conformal.js
@@ -1,4 +1,5 @@
-// @import parallel2
+import "projection";
+import "parallel2";
function conicConformal(φ0, φ1) {
var cosφ0 = Math.cos0),
View
3  geo/projection/conic-equal-area.js
@@ -1,4 +1,5 @@
-// @import parallel2
+import "projection";
+import "parallel2";
function conicEqualArea(φ0, φ1) {
var sinφ0 = Math.sin0),
View
3  geo/projection/conic-equidistant.js
@@ -1,4 +1,5 @@
-// @import parallel2
+import "projection";
+import "parallel2";
function conicEquidistant(φ0, φ1) {
var cosφ0 = Math.cos0),
View
3  geo/projection/craig.js
@@ -1,4 +1,5 @@
-// @import parallel1
+import "projection";
+import "parallel1";
function craig(φ0) {
var tanφ0 = Math.tan0);
View
2  geo/projection/craster.js
@@ -1,3 +1,5 @@
+import "projection";
+
function craster(λ, φ) {
var sqrt3 = Math.sqrt(3);
return [
View
3  geo/projection/cylindrical-equal-area.js
@@ -1,4 +1,5 @@
-// @import parallel1
+import "projection";
+import "parallel1";
function cylindricalEqualArea(φ0) {
var cosφ0 = Math.cos0);
View
2  geo/projection/eckert1.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert1(λ, φ) {
var α = Math.sqrt(8 / (3 * π));
return [
View
2  geo/projection/eckert2.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert2(λ, φ) {
var α = Math.sqrt(4 - 3 * Math.sin(Math.abs(φ)));
return [
View
2  geo/projection/eckert3.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert3(λ, φ) {
var k = Math.sqrt* (4 + π));
return [
View
2  geo/projection/eckert4.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert4(λ, φ) {
var k = (2 + π / 2) * Math.sin(φ);
φ /= 2;
View
2  geo/projection/eckert5.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert5(λ, φ) {
return [
λ * (1 + Math.cos(φ)) / Math.sqrt(2 + π),
View
2  geo/projection/eckert6.js
@@ -1,3 +1,5 @@
+import "projection";
+
function eckert6(λ, φ) {
var k = (1 + π / 2) * Math.sin(φ);
for (var i = 0, δ = Infinity; i < 10 && Math.abs(δ) > ε; i++) {
View
3  geo/projection/eisenlohr.js
@@ -1,4 +1,5 @@
-// @import august
+import "projection";
+import "august";
function eisenlohr(λ, φ) {
var s0 = Math.sin/= 2),
View
2  geo/projection/elliptic.js
@@ -1,3 +1,5 @@
+import "projection";
+
// Returns [sn, cn, dn](u + iv|m).
function ellipticJi(u, v, m) {
if (!u) {
View
2  geo/projection/fahey.js
@@ -1,3 +1,5 @@
+import "projection";
+
function fahey(λ, φ) {
var t = Math.tan(φ / 2);
return [
View
3  geo/projection/gringorten.js
@@ -1,4 +1,5 @@
-// @import quincuncial
+import "projection";
+import "quincuncial";
function gringorten(λ, φ) {
var= sgn(λ),
View
5 geo/projection/guyou.js
@@ -1,5 +1,6 @@
-// @import elliptic
-// @import quincuncial
+import "projection";
+import "elliptic";
+import "quincuncial";
// √k' tn(½K - w) = exp(-ζ).
function guyou(λ, φ) {
View
2  geo/projection/hammer-retroazimuthal.js
@@ -1,3 +1,5 @@
+import "projection";
+
function hammerRetroazimuthal(φ0) {
var sinφ0 = Math.sin0),
cosφ0 = Math.cos0),
View
2  geo/projection/hammer.js
@@ -1,3 +1,5 @@
+import "projection";
+
var hammerAzimuthalEqualArea = d3.geo.azimuthalEqualArea.raw;
function hammer(A, B) {
View
2  geo/projection/hatano.js
@@ -1,3 +1,5 @@
+import "projection";
+
function hatano(λ, φ) {
var c = Math.sin(φ) *< 0 ? 2.43763 : 2.67595);
for (var i = 0, δ; i < 20; i++) {
View
2  geo/projection/healpix.js
@@ -1,3 +1,5 @@
+import "projection";
+
var healpixParallel = 41 + 48 / 36 + 37 / 3600; // TODO automate
function healpix(h) {
View
2  geo/projection/hill.js
@@ -1,3 +1,5 @@
+import "projection";
+
function hill(K) {
var L = 1 + K,
sinβ = Math.sin(1 / L),
View
7 geo/projection/homolosine.js
@@ -1,6 +1,7 @@
-// @import mollweide
-// @import sinusoidal
-// @import sinu-mollweide
+import "projection";
+import "mollweide";
+import "sinusoidal";
+import "sinu-mollweide";
function homolosine(λ, φ) {
return Math.abs(φ) > sinuMollweideφ
View
2  geo/projection/interrupt.js
@@ -1,3 +1,5 @@
+import "projection";
+
d3.geo.interrupt = function(project) {
var lobes = [
[[[-π, 0], [0, π / 2], [π, 0]]],
View
2  geo/projection/kavrayskiy7.js
@@ -1,3 +1,5 @@
+import "projection";
+
function kavrayskiy7(λ, φ) {
return [
3 * λ / (2 * π) * Math.sqrt* π / 3 - φ * φ),
View
2  geo/projection/lagrange.js
@@ -1,3 +1,5 @@
+import "projection";
+
function lagrange(n) {
function forward(λ, φ) {
if (Math.abs(Math.abs(φ) - π / 2) < ε) return [0, φ < 0 ? -2 : 2];
View
2  geo/projection/larrivee.js
@@ -1,3 +1,5 @@
+import "projection";
+
function larrivee(λ, φ) {
return [
λ * (1 + Math.sqrt(Math.cos(φ))) / 2,
View
2  geo/projection/laskowski.js
@@ -1,3 +1,5 @@
+import "projection";
+
function laskowski(λ, φ) {
var λ2 = λ * λ, φ2 = φ * φ;
return [
View
2  geo/projection/littrow.js
@@ -1,3 +1,5 @@
+import "projection";
+
function littrow(λ, φ) {
return [
Math.sin(λ) / Math.cos(φ),
View
3  geo/projection/loximuthal.js
@@ -1,4 +1,5 @@
-// @import parallel1
+import "projection";
+import "parallel1";
function loximuthal(φ0) {
var cosφ0 = Math.cos0),
View
2  geo/projection/miller.js
@@ -1,3 +1,5 @@
+import "projection";
+
function miller(λ, φ) {
return [
λ,
View
2  geo/projection/modified-stereographic.js
@@ -1,3 +1,5 @@
+import "projection";
+
function modifiedStereographic(C) {
var m = C.length - 1;
View
2  geo/projection/mollweide.js
@@ -1,3 +1,5 @@
+import "projection";
+
function mollweideBromleyθ(Cp) {
return function(θ) {
var Cpsinθ = Cp * Math.sin(θ),
View
2  geo/projection/mt-flat-polar-parabolic.js
@@ -1,3 +1,5 @@
+import "projection";
+
function mtFlatPolarParabolic(λ, φ) {
var sqrt6 = Math.sqrt(6),
sqrt7 = Math.sqrt(7),
View
2  geo/projection/mt-flat-polar-quartic.js
@@ -1,3 +1,5 @@
+import "projection";
+
function mtFlatPolarQuartic(λ, φ) {
var k = (1 + Math.SQRT1_2) * Math.sin(φ),
θ = φ;
View
2  geo/projection/mt-flat-polar-sinusoidal.js
@@ -1,3 +1,5 @@
+import "projection";
+
function mtFlatPolarSinusoidal(λ, φ) {
var A = Math.sqrt(6 / (4 + π)),
k = (1 + π / 4) * Math.sin(φ),
View
2  geo/projection/natural-earth.js
@@ -1,3 +1,5 @@
+import "projection";
+
function naturalEarth(λ, φ) {
var φ2 = φ * φ, φ4 = φ2 * φ2;
return [
View
2  geo/projection/nell-hammer.js
@@ -1,3 +1,5 @@
+import "projection";
+
function nellHammer(λ, φ) {
return [
λ * (1 + Math.cos(φ)) / 2,
View
2  geo/projection/parallel1.js
@@ -1,3 +1,5 @@
+import "projection";
+
function parallel1Projection(projectAt) {
var φ0 = 0,
m = projectionMutator(projectAt),
View
2  geo/projection/parallel2.js
@@ -1,3 +1,5 @@
+import "projection";
+
function parallel2Projection(projectAt) {
var φ0 = 0,
φ1 = π / 3,
View
5 geo/projection/peirce-quincuncial.js
@@ -1,5 +1,6 @@
-// @import guyou
-// @import quincuncial
+import "projection";
+import "guyou";
+import "quincuncial";
var peirceQuincuncialProjection = quincuncialProjection(guyou);
View
2  geo/projection/polyconic.js
@@ -1,3 +1,5 @@
+import "projection";
+
function polyconic(λ, φ) {
if (Math.abs(φ) < ε) return [λ, 0];
var tanφ = Math.tan(φ),
View
2  geo/projection/quincuncial.js
@@ -1,3 +1,5 @@
+import "projection";
+
function quincuncialProjection(projectHemisphere) {
var dx = projectHemisphere(π / 2, 0)[0] - projectHemisphere(-π / 2, 0)[0];
View
3  geo/projection/rectangular-polyconic.js
@@ -1,4 +1,5 @@
-// @import parallel1
+import "projection";
+import "parallel1";
function rectangularPolyconic(φ0) {
var sinφ0 = Math.sin(φ0);
View
2  geo/projection/robinson.js
@@ -1,3 +1,5 @@
+import "projection";
+
var robinsonConstants = [
[0.9986, -0.062],
[1.0000, 0.0000],
View
2  geo/projection/satellite.js
@@ -1,3 +1,5 @@
+import "projection";
+
function satelliteVertical(P) {
function forward(λ, φ) {
var cosφ = Math.cos(φ),
View
5 geo/projection/sinu-mollweide.js
@@ -1,5 +1,6 @@
-// @import mollweide
-// @import sinusoidal
+import "projection";
+import "mollweide";
+import "sinusoidal";
var sinuMollweideφ = .7109889596207567,
sinuMollweideY = .0528035274542;
View
2  geo/projection/sinusoidal.js
@@ -1,3 +1,5 @@
+import "projection";
+
function sinusoidal(λ, φ) {
return [
λ * Math.cos(φ),
View
2  geo/projection/times.js
@@ -1,3 +1,5 @@
+import "projection";
+
function times(λ, φ) {
var t = Math.tan(φ / 2),
s = Math.sin(π / 4 * t);
View
2  geo/projection/transverse-mercator.js
@@ -1,3 +1,5 @@
+import "projection";
+
function transverseMercator(λ, φ) {
var B = Math.cos(φ) * Math.sin(λ);
return [
View
3  geo/projection/two-point-azimuthal.js
@@ -1,4 +1,5 @@
-// @import two-point-equidistant
+import "projection";
+import "two-point-equidistant";
function twoPointAzimuthal(d) {
var cosd = Math.cos(d);
View
2  geo/projection/two-point-equidistant.js
@@ -1,3 +1,5 @@
+import "projection";
+
// TODO clip to ellipse
// TODO expose d3.geo.rotation?
View
2  geo/projection/van-der-grinten.js
@@ -1,3 +1,5 @@
+import "projection";
+
function vanDerGrinten(λ, φ) {
if (Math.abs(φ) < ε) return [λ, 0];
var sinθ = Math.abs(2 * φ / π),
View
2  geo/projection/van-der-grinten2.js
@@ -1,3 +1,5 @@
+import "projection";
+
function vanDerGrinten2(λ, φ) {
if (Math.abs(φ) < ε) return [λ, 0];
var sinθ = Math.abs(2 * φ / π),
View
2  geo/projection/van-der-grinten3.js
@@ -1,3 +1,5 @@
+import "projection";
+
function vanDerGrinten3(λ, φ) {
if (Math.abs(φ) < ε) return [λ, 0];
var sinθ = 2 * φ / π,
View
2  geo/projection/van-der-grinten4.js
@@ -1,3 +1,5 @@
+import "projection";
+
function vanDerGrinten4(λ, φ) {
if (!φ) return [λ, 0];
var φ0 = Math.abs(φ);
View
3  geo/projection/wagner4.js
@@ -1,4 +1,5 @@
-// @import mollweide
+import "projection";
+import "mollweide";
var wagner4 = (function() {
var A = 4 * π + 3 * Math.sqrt(3),
View
2  geo/projection/wagner6.js
@@ -1,3 +1,5 @@
+import "projection";
+
function wagner6(λ, φ) {
return [
λ * Math.sqrt(1 - 3 * φ * φ / (π * π)),
View
2  geo/projection/wagner7.js
@@ -1,3 +1,5 @@
+import "projection";
+
function wagner7(λ, φ) {
var s = .90631 * Math.sin(φ),
c0 = Math.sqrt(1 - s * s),
View
2  geo/projection/wiechel.js
@@ -1,3 +1,5 @@
+import "projection";
+
function wiechel(λ, φ) {
var cosφ = Math.cos(φ),
sinφ = Math.cos(λ) * cosφ,
View
3  geo/projection/winkel3.js
@@ -1,4 +1,5 @@
-// @import aitoff
+import "projection";
+import "aitoff";
function winkel3(λ, φ) {
var coordinates = aitoff(λ, φ);
View
1  package.json
@@ -12,6 +12,7 @@
"d3": "3.0.x"
},
"devDependencies": {
+ "smash": "~0.0.3",
"uglify-js": "2.2.x",
"vows": "0.7.x"
},
Please sign in to comment.
Something went wrong with that request. Please try again.