source: node_modules/d3-geo/src/projection/conicEquidistant.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 855 bytes
RevLine 
[e4c61dd]1import {abs, atan2, cos, epsilon, pi, sign, sin, sqrt} from "../math.js";
2import {conicProjection} from "./conic.js";
3import {equirectangularRaw} from "./equirectangular.js";
4
5export function conicEquidistantRaw(y0, y1) {
6 var cy0 = cos(y0),
7 n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0),
8 g = cy0 / n + y0;
9
10 if (abs(n) < epsilon) return equirectangularRaw;
11
12 function project(x, y) {
13 var gy = g - y, nx = n * x;
14 return [gy * sin(nx), g - gy * cos(nx)];
15 }
16
17 project.invert = function(x, y) {
18 var gy = g - y,
19 l = atan2(x, abs(gy)) * sign(gy);
20 if (gy * n < 0)
21 l -= pi * sign(x) * sign(gy);
22 return [l / n, g - sign(n) * sqrt(x * x + gy * gy)];
23 };
24
25 return project;
26}
27
28export default function() {
29 return conicProjection(conicEquidistantRaw)
30 .scale(131.154)
31 .center([0, 13.9389]);
32}
Note: See TracBrowser for help on using the repository browser.