This repository has been archived by the owner on Nov 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract math and hyperbolic functions.
Also, add missing geo/projection/index.js file.
- Loading branch information
1 parent
c6fef9f
commit c88daab
Showing
7 changed files
with
122 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import "projection"; | ||
import "hyperbolic"; | ||
|
||
function august(λ, φ) { | ||
var tanφ = Math.tan(φ / 2), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import "math"; | ||
|
||
function tanh(x) { | ||
x = Math.exp(2 * x); | ||
return (x - 1) / (x + 1); | ||
} | ||
|
||
function sinh(x) { | ||
return .5 * (Math.exp(x) - Math.exp(-x)); | ||
} | ||
|
||
function cosh(x) { | ||
return .5 * (Math.exp(x) + Math.exp(-x)); | ||
} | ||
|
||
function arsinh(x) { | ||
return Math.log(x + asqrt(x * x + 1)); | ||
} | ||
|
||
function arcosh(x) { | ||
return Math.log(x + asqrt(x * x - 1)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import "start"; | ||
import "quincuncial"; | ||
import "interrupt"; | ||
import "aitoff"; | ||
import "guyou"; | ||
import "mollweide"; | ||
import "sinusoidal"; | ||
import "sinu-mollweide"; | ||
import "armadillo"; | ||
import "august"; | ||
import "baker"; | ||
import "berghaus"; | ||
import "boggs"; | ||
import "bonne"; | ||
import "bromley"; | ||
import "collignon"; | ||
import "conic-conformal"; | ||
import "conic-equal-area"; | ||
import "conic-equidistant"; | ||
import "craig"; | ||
import "craster"; | ||
import "cylindrical-equal-area"; | ||
import "eckert1"; | ||
import "eckert2"; | ||
import "eckert3"; | ||
import "eckert4"; | ||
import "eckert5"; | ||
import "eckert6"; | ||
import "eisenlohr"; | ||
import "fahey"; | ||
import "gringorten"; | ||
import "hammer-retroazimuthal"; | ||
import "hammer"; | ||
import "hatano"; | ||
import "healpix"; | ||
import "hill"; | ||
import "homolosine"; | ||
import "kavrayskiy7"; | ||
import "lagrange"; | ||
import "larrivee"; | ||
import "laskowski"; | ||
import "littrow"; | ||
import "loximuthal"; | ||
import "miller"; | ||
import "modified-stereographic"; | ||
import "mt-flat-polar-parabolic"; | ||
import "mt-flat-polar-quartic"; | ||
import "mt-flat-polar-sinusoidal"; | ||
import "natural-earth"; | ||
import "nell-hammer"; | ||
import "peirce-quincuncial"; | ||
import "polyconic"; | ||
import "rectangular-polyconic"; | ||
import "robinson"; | ||
import "satellite"; | ||
import "times"; | ||
import "transverse-mercator"; | ||
import "two-point-azimuthal"; | ||
import "two-point-equidistant"; | ||
import "van-der-grinten"; | ||
import "van-der-grinten2"; | ||
import "van-der-grinten3"; | ||
import "van-der-grinten4"; | ||
import "wagner4"; | ||
import "wagner6"; | ||
import "wagner7"; | ||
import "wiechel"; | ||
import "winkel3"; | ||
import "end"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var ε = 1e-6, | ||
ε2 = ε * ε, | ||
π = Math.PI, | ||
sqrtπ = Math.sqrt(π), | ||
radians = π / 180, | ||
degrees = 180 / π; | ||
|
||
function sinci(x) { | ||
return x ? x / Math.sin(x) : 1; | ||
} | ||
|
||
function sgn(x) { | ||
return x > 0 ? 1 : x < 0 ? -1 : 0; | ||
} | ||
|
||
function asin(x) { | ||
return x > 1 ? π / 2 : x < -1 ? -π / 2 : Math.asin(x); | ||
} | ||
|
||
function acos(x) { | ||
return x > 1 ? 0 : x < -1 ? π : Math.acos(x); | ||
} | ||
|
||
function asqrt(x) { | ||
return x > 0 ? Math.sqrt(x) : 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,4 @@ | ||
var ε = 1e-6, | ||
ε2 = ε * ε, | ||
π = Math.PI, | ||
sqrtπ = Math.sqrt(π), | ||
radians = π / 180, | ||
degrees = 180 / π; | ||
import "math"; | ||
|
||
var projection = d3.geo.projection, | ||
projectionMutator = d3.geo.projectionMutator; | ||
|
||
function sinci(x) { | ||
return x ? x / Math.sin(x) : 1; | ||
} | ||
|
||
function sgn(x) { | ||
return x > 0 ? 1 : x < 0 ? -1 : 0; | ||
} | ||
|
||
function asqrt(x) { | ||
return x > 0 ? Math.sqrt(x) : 0; | ||
} | ||
|
||
function asin(x) { | ||
return x > 1 ? π / 2 : x < -1 ? -π / 2 : Math.asin(x); | ||
} | ||
|
||
function acos(x) { | ||
return x > 1 ? 0 : x < -1 ? π : Math.acos(x); | ||
} | ||
|
||
function tanh(x) { | ||
x = Math.exp(2 * x); | ||
return (x - 1) / (x + 1); | ||
} | ||
|
||
function sinh(x) { | ||
return .5 * (Math.exp(x) - Math.exp(-x)); | ||
} | ||
|
||
function cosh(x) { | ||
return .5 * (Math.exp(x) + Math.exp(-x)); | ||
} | ||
|
||
function arsinh(x) { | ||
return Math.log(x + asqrt(x * x + 1)); | ||
} | ||
|
||
function arcosh(x) { | ||
return Math.log(x + asqrt(x * x - 1)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters