| import "../math/trigonometry"; | |
| import "geo"; | |
| import "conic"; | |
| import "projection"; | |
| function d3_geo_conicEqualArea(φ0, φ1) { | |
| var sinφ0 = Math.sin(φ0), | |
| n = (sinφ0 + Math.sin(φ1)) / 2, | |
| C = 1 + sinφ0 * (2 * n - sinφ0), | |
| ρ0 = Math.sqrt(C) / n; | |
| function forward(λ, φ) { | |
| var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n; | |
| return [ | |
| ρ * Math.sin(λ *= n), | |
| ρ0 - ρ * Math.cos(λ) | |
| ]; | |
| } | |
| forward.invert = function(x, y) { | |
| var ρ0_y = ρ0 - y; | |
| return [ | |
| Math.atan2(x, ρ0_y) / n, | |
| d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) | |
| ]; | |
| }; | |
| return forward; | |
| } | |
| (d3.geo.conicEqualArea = function() { | |
| return d3_geo_conic(d3_geo_conicEqualArea); | |
| }).raw = d3_geo_conicEqualArea; |