dgeoutils 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{DCircle.d.ts → cjs/DCircle.d.ts} +0 -0
  2. package/dist/cjs/DCircle.js +102 -0
  3. package/dist/{DLine.d.ts → cjs/DLine.d.ts} +0 -0
  4. package/dist/cjs/DLine.js +310 -0
  5. package/dist/{DNumbers.d.ts → cjs/DNumbers.d.ts} +0 -0
  6. package/dist/cjs/DNumbers.js +30 -0
  7. package/dist/{DPlane.d.ts → cjs/DPlane.d.ts} +0 -0
  8. package/dist/cjs/DPlane.js +132 -0
  9. package/dist/{DPoint.d.ts → cjs/DPoint.d.ts} +0 -0
  10. package/dist/cjs/DPoint.js +574 -0
  11. package/dist/{DPolygon.d.ts → cjs/DPolygon.d.ts} +0 -0
  12. package/dist/cjs/DPolygon.js +1560 -0
  13. package/dist/{DPolygonLoop.d.ts → cjs/DPolygonLoop.d.ts} +0 -0
  14. package/dist/cjs/DPolygonLoop.js +401 -0
  15. package/dist/{FastSearch.d.ts → cjs/FastSearch.d.ts} +0 -0
  16. package/dist/cjs/FastSearch.js +53 -0
  17. package/dist/{TraceMatrix.d.ts → cjs/TraceMatrix.d.ts} +0 -0
  18. package/dist/cjs/TraceMatrix.js +256 -0
  19. package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
  20. package/dist/{index.js → cjs/index.js} +5 -1
  21. package/dist/{utils.d.ts → cjs/utils.d.ts} +0 -0
  22. package/dist/cjs/utils.js +216 -0
  23. package/dist/{DCircle.js → es2015/DCircle.js} +14 -18
  24. package/dist/{DLine.js → es2015/DLine.js} +24 -28
  25. package/dist/es2015/DNumbers.js +22 -0
  26. package/dist/{DPlane.js → es2015/DPlane.js} +22 -26
  27. package/dist/{DPoint.js → es2015/DPoint.js} +52 -56
  28. package/dist/{DPolygon.js → es2015/DPolygon.js} +41 -45
  29. package/dist/{DPolygonLoop.js → es2015/DPolygonLoop.js} +1 -5
  30. package/dist/{FastSearch.js → es2015/FastSearch.js} +1 -5
  31. package/dist/{TraceMatrix.js → es2015/TraceMatrix.js} +35 -39
  32. package/dist/es2015/index.js +10 -0
  33. package/dist/{utils.js → es2015/utils.js} +29 -41
  34. package/dist/esm/DCircle.js +1 -1
  35. package/dist/esm/DLine.js +2 -2
  36. package/dist/esm/DPoint.js +2 -2
  37. package/dist/esm/DPolygon.js +8 -8
  38. package/dist/esm/utils.js +6 -6
  39. package/dist/umd/dgeoutils.js +26 -26
  40. package/dist/umd/dgeoutils.min.js +1 -1
  41. package/dist/umd/dgeoutils.min.js.map +1 -1
  42. package/package.json +8 -13
  43. package/dist/DNumbers.js +0 -26
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DLine = void 0;
4
- const DPoint_1 = require("./DPoint");
5
- const utils_1 = require("./utils");
6
- const DNumbers_1 = require("./DNumbers");
7
- class DLine {
8
- constructor(a, b, c, begin = DPoint_1.DPoint.zero(), end = DPoint_1.DPoint.zero()) {
1
+ import { DPoint } from './DPoint';
2
+ import { checkFunction } from './utils';
3
+ import { DNumbers } from './DNumbers';
4
+ export class DLine {
5
+ constructor(a, b, c, begin = DPoint.zero(), end = DPoint.zero()) {
9
6
  this.a = a;
10
7
  this.b = b;
11
8
  this.c = c;
@@ -16,7 +13,7 @@ class DLine {
16
13
  return new DLine(this.a, this.b, this.c, this.begin.clone(), this.end.clone());
17
14
  }
18
15
  findPerpendicular(p) {
19
- (0, utils_1.checkFunction)('findPerpendicular')
16
+ checkFunction('findPerpendicular')
20
17
  .checkArgument('this.begin')
21
18
  .shouldBeMeters(this.begin)
22
19
  .checkArgument('this.end')
@@ -26,7 +23,7 @@ class DLine {
26
23
  return new DLine(-this.b, this.a, this.b * p.x - this.a * p.y);
27
24
  }
28
25
  perpendicularDistance(p) {
29
- (0, utils_1.checkFunction)('perpendicularDistance')
26
+ checkFunction('perpendicularDistance')
30
27
  .checkArgument('this.begin')
31
28
  .shouldBeMeters(this.begin)
32
29
  .checkArgument('this.end')
@@ -140,21 +137,21 @@ class DLine {
140
137
  }
141
138
  x(p) {
142
139
  if (this.isParallelY) {
143
- return new DPoint_1.DPoint(-this.c / this.a, p.y);
140
+ return new DPoint(-this.c / this.a, p.y);
144
141
  }
145
142
  if (this.isParallelX) {
146
- return new DPoint_1.DPoint(p.x, -this.c / this.b);
143
+ return new DPoint(p.x, -this.c / this.b);
147
144
  }
148
- return new DPoint_1.DPoint(-this.b / this.a * p.y - this.c / this.a, p.y);
145
+ return new DPoint(-this.b / this.a * p.y - this.c / this.a, p.y);
149
146
  }
150
147
  y(p) {
151
148
  if (this.isParallelY) {
152
- return new DPoint_1.DPoint(-this.c / this.a, p.y);
149
+ return new DPoint(-this.c / this.a, p.y);
153
150
  }
154
151
  if (this.isParallelX) {
155
- return new DPoint_1.DPoint(p.x, -this.c / this.b);
152
+ return new DPoint(p.x, -this.c / this.b);
156
153
  }
157
- return new DPoint_1.DPoint(p.x, -this.a / this.b * p.x - this.c / this.b);
154
+ return new DPoint(p.x, -this.a / this.b * p.x - this.c / this.b);
158
155
  }
159
156
  findPoint(l) {
160
157
  if (this.isParallelY && l.isParallelY) {
@@ -164,28 +161,28 @@ class DLine {
164
161
  return null;
165
162
  }
166
163
  if (this.isParallelX && l.isParallelY) {
167
- return new DPoint_1.DPoint(-l.c / l.a, -this.c / this.b);
164
+ return new DPoint(-l.c / l.a, -this.c / this.b);
168
165
  }
169
166
  if (this.isParallelY && l.isParallelX) {
170
- return new DPoint_1.DPoint(-this.c / this.a, -l.c / l.b);
167
+ return new DPoint(-this.c / this.a, -l.c / l.b);
171
168
  }
172
169
  if (this.isParallelY) {
173
170
  const x = -this.c / this.a;
174
- return l.y(new DPoint_1.DPoint(x));
171
+ return l.y(new DPoint(x));
175
172
  }
176
173
  if (this.isParallelX) {
177
174
  const y = -this.c / this.b;
178
- return l.x(new DPoint_1.DPoint(0, y));
175
+ return l.x(new DPoint(0, y));
179
176
  }
180
177
  if (l.isParallelY) {
181
178
  const x = -l.c / l.a;
182
- return this.y(new DPoint_1.DPoint(x));
179
+ return this.y(new DPoint(x));
183
180
  }
184
181
  if (l.isParallelX) {
185
182
  const y = -l.c / l.b;
186
- return this.x(new DPoint_1.DPoint(0, y));
183
+ return this.x(new DPoint(0, y));
187
184
  }
188
- const res = this.y(new DPoint_1.DPoint((l.c / l.b - this.c / this.b) / (this.a / this.b - l.a / l.b)));
185
+ const res = this.y(new DPoint((l.c / l.b - this.c / this.b) / (this.a / this.b - l.a / l.b)));
189
186
  if (!isFinite(res.x) && !isFinite(res.y)) {
190
187
  return null;
191
188
  }
@@ -204,7 +201,7 @@ class DLine {
204
201
  return [this.begin, this.end];
205
202
  }
206
203
  getFi() {
207
- (0, utils_1.checkFunction)('getFi')
204
+ checkFunction('getFi')
208
205
  .checkArgument('this.begin')
209
206
  .shouldBeMeters(this.begin)
210
207
  .checkArgument('this.end')
@@ -225,13 +222,13 @@ class DLine {
225
222
  const p = isArray ? i : [i];
226
223
  const d = (isArray ? k : [k]);
227
224
  const fi = this.findFi(new DLine(1, 0, 0));
228
- const td = this.x(new DPoint_1.DPoint(1, 1)).distance(this.x(new DPoint_1.DPoint(2, 2))) / 2;
229
- const sinCos = new DPoint_1.DPoint(Math.sin(fi), Math.cos(fi));
225
+ const td = this.x(new DPoint(1, 1)).distance(this.x(new DPoint(2, 2))) / 2;
226
+ const sinCos = new DPoint(Math.sin(fi), Math.cos(fi));
230
227
  const dt = sinCos.clone().scale(td);
231
228
  const p1T = p[0].clone().move(dt.clone().minus());
232
229
  const p2T = p[0].clone().move(dt);
233
230
  let res = [];
234
- if (DNumbers_1.DNumbers.like(this.y(p1T).y, p1T.y) || DNumbers_1.DNumbers.like(this.y(p2T).y, p2T.y)) {
231
+ if (DNumbers.like(this.y(p1T).y, p1T.y) || DNumbers.like(this.y(p2T).y, p2T.y)) {
235
232
  res = p.map((t, index) => t.clone()
236
233
  .move(sinCos.clone().scale(d[index])));
237
234
  }
@@ -258,4 +255,3 @@ class DLine {
258
255
  return new DLine(w * c - e * b, e * a - q * c, q * b - w * a);
259
256
  }
260
257
  }
261
- exports.DLine = DLine;
@@ -0,0 +1,22 @@
1
+ import { DEGREE_TO_PI, DOUBLE_PI_IN_DEGREE, PI_IN_DEGREE, PI_TO_DEGREE } from './DPoint';
2
+ const delta = 0.001;
3
+ export class DNumbers {
4
+ static like(v, s, d = delta) {
5
+ return Math.abs(v - s) < d;
6
+ }
7
+ static likeZero(v) {
8
+ return DNumbers.like(v, 0);
9
+ }
10
+ static like2PI(v) {
11
+ return DNumbers.like(DNumbers.rad2Deg(v), DOUBLE_PI_IN_DEGREE);
12
+ }
13
+ static likePI(v) {
14
+ return DNumbers.like(DNumbers.rad2Deg(v), PI_IN_DEGREE);
15
+ }
16
+ static rad2Deg(v) {
17
+ return v * DEGREE_TO_PI;
18
+ }
19
+ static deg2Rad(v) {
20
+ return v * PI_TO_DEGREE;
21
+ }
22
+ }
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DPlane = void 0;
4
- const DPoint_1 = require("./DPoint");
5
- const utils_1 = require("./utils");
6
- const DNumbers_1 = require("./DNumbers");
7
- class DPlane {
8
- constructor(a, b, c, d, p1 = DPoint_1.DPoint.zero(), p2 = DPoint_1.DPoint.zero(), p3 = DPoint_1.DPoint.zero()) {
1
+ import { DPoint } from './DPoint';
2
+ import { gaussianElimination } from './utils';
3
+ import { DNumbers } from './DNumbers';
4
+ export class DPlane {
5
+ constructor(a, b, c, d, p1 = DPoint.zero(), p2 = DPoint.zero(), p3 = DPoint.zero()) {
9
6
  this.a = a;
10
7
  this.b = b;
11
8
  this.c = c;
@@ -25,7 +22,7 @@ class DPlane {
25
22
  return new DPlane(0, 0, 1, -p1.z, p1, p2, p3);
26
23
  }
27
24
  const d = 1;
28
- const [a, b, c] = (0, utils_1.gaussianElimination)([
25
+ const [a, b, c] = gaussianElimination([
29
26
  [p1.x, p1.y, p1.z, -d],
30
27
  [p2.x, p2.y, p2.z, -d],
31
28
  [p3.x, p3.y, p3.z, -d]
@@ -33,7 +30,7 @@ class DPlane {
33
30
  return new DPlane(a, b, c, d, p1, p2, p3);
34
31
  }
35
32
  x(p) {
36
- if (p instanceof DPoint_1.DPoint) {
33
+ if (p instanceof DPoint) {
37
34
  const { a, b, c, d } = this;
38
35
  const { y, z } = p;
39
36
  p.x = -(b * y + c * z + d) / a;
@@ -42,7 +39,7 @@ class DPlane {
42
39
  return p.map((t) => this.x(t));
43
40
  }
44
41
  y(p) {
45
- if (p instanceof DPoint_1.DPoint) {
42
+ if (p instanceof DPoint) {
46
43
  const { a, b, c, d } = this;
47
44
  const { x, z } = p;
48
45
  p.y = -(a * x + c * z + d) / b;
@@ -51,7 +48,7 @@ class DPlane {
51
48
  return p.map((t) => this.y(t));
52
49
  }
53
50
  z(p) {
54
- if (p instanceof DPoint_1.DPoint) {
51
+ if (p instanceof DPoint) {
55
52
  const { a, b, c, d } = this;
56
53
  const { x, y } = p;
57
54
  p.z = -(a * x + b * y + d) / c;
@@ -64,7 +61,7 @@ class DPlane {
64
61
  return new DPlane(a, b, c, d, p1, p2, p3);
65
62
  }
66
63
  distance(p) {
67
- if (p instanceof DPoint_1.DPoint) {
64
+ if (p instanceof DPoint) {
68
65
  const { x, y, z } = p;
69
66
  const { a, b, c, d } = this;
70
67
  return Math.abs(a * x + b * y + c * z + d) / Math.sqrt(a * a + b * b + c * c);
@@ -76,10 +73,10 @@ class DPlane {
76
73
  equal(p) {
77
74
  const { a, b, c, d } = p;
78
75
  const { a: q, b: w, c: e, d: r } = this;
79
- return DNumbers_1.DNumbers.like(a, q) &&
80
- DNumbers_1.DNumbers.like(b, w) &&
81
- DNumbers_1.DNumbers.like(c, e) &&
82
- DNumbers_1.DNumbers.like(d, r);
76
+ return DNumbers.like(a, q) &&
77
+ DNumbers.like(b, w) &&
78
+ DNumbers.like(c, e) &&
79
+ DNumbers.like(d, r);
83
80
  }
84
81
  same(p) {
85
82
  const { a, b, c, d } = p;
@@ -88,10 +85,10 @@ class DPlane {
88
85
  const y = b / w;
89
86
  const u = c / e;
90
87
  const i = d / r;
91
- return DNumbers_1.DNumbers.like(t, y) &&
92
- DNumbers_1.DNumbers.like(t, u) &&
93
- DNumbers_1.DNumbers.like(t, c) &&
94
- DNumbers_1.DNumbers.like(t, i);
88
+ return DNumbers.like(t, y) &&
89
+ DNumbers.like(t, u) &&
90
+ DNumbers.like(t, c) &&
91
+ DNumbers.like(t, i);
95
92
  }
96
93
  parallel(p) {
97
94
  const { a, b, c, d } = p;
@@ -100,10 +97,9 @@ class DPlane {
100
97
  const y = b / w;
101
98
  const u = c / e;
102
99
  const i = d / r;
103
- return DNumbers_1.DNumbers.like(t, y) &&
104
- DNumbers_1.DNumbers.like(t, u) &&
105
- DNumbers_1.DNumbers.like(t, c) &&
106
- !DNumbers_1.DNumbers.like(t, i);
100
+ return DNumbers.like(t, y) &&
101
+ DNumbers.like(t, u) &&
102
+ DNumbers.like(t, c) &&
103
+ !DNumbers.like(t, i);
107
104
  }
108
105
  }
109
- exports.DPlane = DPlane;
@@ -1,24 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DPoint = exports.DEGREE_TO_PI = exports.PI_TO_DEGREE = exports.DOUBLE_PI_IN_DEGREE = exports.PI_IN_DEGREE = exports.HALF_PI_IN_DEGREE = exports.EARTH_RADIUS_IN_METERS = void 0;
4
- const DLine_1 = require("./DLine");
5
- const DPolygon_1 = require("./DPolygon");
6
- const utils_1 = require("./utils");
1
+ import { DLine } from './DLine';
2
+ import { DPolygon } from './DPolygon';
3
+ import { checkFunction, createArray, isDefAndNotNull } from './utils';
7
4
  const diff = 0;
8
- const radiansPolygon = new DPolygon_1.DPolygon();
9
- const pseudoMercatorPolygon = new DPolygon_1.DPolygon();
10
- const worldGeodeticPolygon = new DPolygon_1.DPolygon();
11
- exports.EARTH_RADIUS_IN_METERS = 6371008.8;
5
+ const radiansPolygon = new DPolygon();
6
+ const pseudoMercatorPolygon = new DPolygon();
7
+ const worldGeodeticPolygon = new DPolygon();
8
+ export const EARTH_RADIUS_IN_METERS = 6371008.8;
12
9
  const EARTH_IN_MITERS = 20037508.34;
13
10
  const DEGREES_IN_EARTH = 180;
14
11
  const MITERS_IN_ONE_DEGREE = EARTH_IN_MITERS / DEGREES_IN_EARTH;
15
12
  const DEGREES_IN_ONE_MITER = DEGREES_IN_EARTH / EARTH_IN_MITERS;
16
- exports.HALF_PI_IN_DEGREE = 90;
17
- exports.PI_IN_DEGREE = 180;
18
- exports.DOUBLE_PI_IN_DEGREE = 360;
19
- exports.PI_TO_DEGREE = Math.PI / exports.PI_IN_DEGREE;
20
- exports.DEGREE_TO_PI = exports.PI_IN_DEGREE / Math.PI;
21
- class DPoint {
13
+ export const HALF_PI_IN_DEGREE = 90;
14
+ export const PI_IN_DEGREE = 180;
15
+ export const DOUBLE_PI_IN_DEGREE = 360;
16
+ export const PI_TO_DEGREE = Math.PI / PI_IN_DEGREE;
17
+ export const DEGREE_TO_PI = PI_IN_DEGREE / Math.PI;
18
+ export class DPoint {
22
19
  constructor(x = 0, y = x, z) {
23
20
  this.x = x;
24
21
  this.y = y;
@@ -47,20 +44,20 @@ class DPoint {
47
44
  return new DPoint(Math.random(), Math.random());
48
45
  }
49
46
  getTileFromCoords(zoom = this.z) {
50
- (0, utils_1.checkFunction)('getTileFromCoords')
47
+ checkFunction('getTileFromCoords')
51
48
  .checkArgument('this')
52
49
  .shouldBeDegree(this);
53
- const x = Math.floor((this.x + exports.PI_IN_DEGREE) / exports.DOUBLE_PI_IN_DEGREE * (Math.pow(2, zoom)));
54
- const y = Math.floor((1 - Math.log(Math.tan(this.y * exports.PI_TO_DEGREE) + 1 / Math.cos(this.y * exports.PI_TO_DEGREE)) / Math.PI) / 2 * (Math.pow(2, zoom)));
50
+ const x = Math.floor((this.x + PI_IN_DEGREE) / DOUBLE_PI_IN_DEGREE * (Math.pow(2, zoom)));
51
+ const y = Math.floor((1 - Math.log(Math.tan(this.y * PI_TO_DEGREE) + 1 / Math.cos(this.y * PI_TO_DEGREE)) / Math.PI) / 2 * (Math.pow(2, zoom)));
55
52
  return new DPoint(x, y, zoom);
56
53
  }
57
54
  getCoordsFromTile(zoom = this.z) {
58
- (0, utils_1.checkFunction)('getCoordsFromTile')
55
+ checkFunction('getCoordsFromTile')
59
56
  .checkArgument('this')
60
57
  .shouldBeUInt(this);
61
58
  const n = Math.PI - 2 * Math.PI * this.y / (Math.pow(2, zoom));
62
- const x = this.x / (Math.pow(2, zoom)) * exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE;
63
- const y = exports.PI_IN_DEGREE / Math.PI * Math.atan((Math.exp(n) - Math.exp(-n)) / 2);
59
+ const x = this.x / (Math.pow(2, zoom)) * DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE;
60
+ const y = PI_IN_DEGREE / Math.PI * Math.atan((Math.exp(n) - Math.exp(-n)) / 2);
64
61
  return new DPoint(x, y, zoom);
65
62
  }
66
63
  toCoords() {
@@ -70,7 +67,7 @@ class DPoint {
70
67
  return [this.x, this.y, this.z];
71
68
  }
72
69
  findLine(p) {
73
- (0, utils_1.checkFunction)('findLine')
70
+ checkFunction('findLine')
74
71
  .checkArgument('this')
75
72
  .shouldBeMeters(this)
76
73
  .checkArgument('p')
@@ -82,15 +79,15 @@ class DPoint {
82
79
  const b = p.x - this.x - diff;
83
80
  const c = this.x * p.y - p.x * this.y - diff;
84
81
  if (a === 0) {
85
- return new DLine_1.DLine(0, 1, c / b, this, p);
82
+ return new DLine(0, 1, c / b, this, p);
86
83
  }
87
84
  if (b === 0) {
88
- return new DLine_1.DLine(1, 0, c / a, this, p);
85
+ return new DLine(1, 0, c / a, this, p);
89
86
  }
90
- return new DLine_1.DLine(a, b, c, this, p);
87
+ return new DLine(a, b, c, this, p);
91
88
  }
92
89
  findInnerAngle(p1, p3) {
93
- (0, utils_1.checkFunction)('findInnerAngle')
90
+ checkFunction('findInnerAngle')
94
91
  .checkArgument('this')
95
92
  .shouldBeMeters(this)
96
93
  .checkArgument('p1')
@@ -119,7 +116,7 @@ class DPoint {
119
116
  return `POINT (${x} ${y})`;
120
117
  }
121
118
  distance(p) {
122
- (0, utils_1.checkFunction)('distance')
119
+ checkFunction('distance')
123
120
  .checkArgument('this')
124
121
  .shouldBeMeters(this)
125
122
  .checkArgument('p')
@@ -129,7 +126,7 @@ class DPoint {
129
126
  return Math.sqrt(dx * dx + dy * dy);
130
127
  }
131
128
  distance3d(p) {
132
- (0, utils_1.checkFunction)('distance3d')
129
+ checkFunction('distance3d')
133
130
  .checkArgument('this')
134
131
  .shouldBeMeters(this)
135
132
  .checkArgument('p')
@@ -204,66 +201,66 @@ class DPoint {
204
201
  if (x instanceof DPoint) {
205
202
  xV = this.x + x.x;
206
203
  yV = this.y + x.y;
207
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(x.z)) {
204
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
208
205
  zV = this.z + x.z;
209
206
  }
210
207
  }
211
208
  else {
212
209
  xV = this.x + x;
213
210
  yV = this.y + y;
214
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(z)) {
211
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
215
212
  zV = this.z + z;
216
213
  }
217
214
  }
218
215
  this.x = xV;
219
216
  this.y = yV;
220
- if ((0, utils_1.isDefAndNotNull)(zV)) {
217
+ if (isDefAndNotNull(zV)) {
221
218
  this.z = zV;
222
219
  }
223
220
  return this;
224
221
  }
225
222
  degreeToMeters() {
226
- (0, utils_1.checkFunction)('degreeToMeters')
223
+ checkFunction('degreeToMeters')
227
224
  .checkArgument('this')
228
225
  .shouldBeDegree(this);
229
- const x = ((this.x + exports.PI_IN_DEGREE) % exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
230
- const y = (Math.log(Math.tan(((this.y + exports.HALF_PI_IN_DEGREE) % exports.PI_IN_DEGREE) *
231
- (Math.PI / exports.DOUBLE_PI_IN_DEGREE))) / exports.PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
226
+ const x = ((this.x + PI_IN_DEGREE) % DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
227
+ const y = (Math.log(Math.tan(((this.y + HALF_PI_IN_DEGREE) % PI_IN_DEGREE) *
228
+ (Math.PI / DOUBLE_PI_IN_DEGREE))) / PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
232
229
  this.x = x;
233
230
  this.y = y;
234
231
  return this;
235
232
  }
236
233
  metersToDegree() {
237
- (0, utils_1.checkFunction)('metersToDegree')
234
+ checkFunction('metersToDegree')
238
235
  .checkArgument('this')
239
236
  .shouldBeMeters(this);
240
237
  const lon = this.x * DEGREES_IN_ONE_MITER;
241
- const lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * exports.PI_TO_DEGREE))) *
242
- (exports.DOUBLE_PI_IN_DEGREE / Math.PI) - exports.HALF_PI_IN_DEGREE;
238
+ const lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * PI_TO_DEGREE))) *
239
+ (DOUBLE_PI_IN_DEGREE / Math.PI) - HALF_PI_IN_DEGREE;
243
240
  this.x = lon;
244
241
  this.y = lat;
245
242
  return this;
246
243
  }
247
244
  degreeToRadians() {
248
- (0, utils_1.checkFunction)('degreeToRadians')
245
+ checkFunction('degreeToRadians')
249
246
  .checkArgument('this')
250
247
  .shouldBeDegree(this);
251
- return this.scale(exports.PI_TO_DEGREE);
248
+ return this.scale(PI_TO_DEGREE);
252
249
  }
253
250
  radiansToDegrees() {
254
- (0, utils_1.checkFunction)('radiansToDegrees')
251
+ checkFunction('radiansToDegrees')
255
252
  .checkArgument('this')
256
253
  .shouldBeRadians(this);
257
- return this.scale(exports.DEGREE_TO_PI);
254
+ return this.scale(DEGREE_TO_PI);
258
255
  }
259
256
  radiansToMeters() {
260
- (0, utils_1.checkFunction)('radiansToMeters')
257
+ checkFunction('radiansToMeters')
261
258
  .checkArgument('this')
262
259
  .shouldBeRadians(this);
263
260
  return this.radiansToDegrees().degreeToMeters();
264
261
  }
265
262
  metersToRadians() {
266
- (0, utils_1.checkFunction)('metersToRadians')
263
+ checkFunction('metersToRadians')
267
264
  .checkArgument('this')
268
265
  .shouldBeMeters(this);
269
266
  return this.metersToDegree().degreeToRadians();
@@ -300,20 +297,20 @@ class DPoint {
300
297
  if (x instanceof DPoint) {
301
298
  xV = this.x * x.x;
302
299
  yV = this.y * x.y;
303
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(x.z)) {
300
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
304
301
  zV = this.z * x.z;
305
302
  }
306
303
  }
307
304
  else {
308
305
  xV = this.x * x;
309
306
  yV = this.y * y;
310
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(z)) {
307
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
311
308
  zV = this.z * z;
312
309
  }
313
310
  }
314
311
  this.x = xV;
315
312
  this.y = yV;
316
- if ((0, utils_1.isDefAndNotNull)(zV)) {
313
+ if (isDefAndNotNull(zV)) {
317
314
  this.z = zV;
318
315
  }
319
316
  return this;
@@ -325,20 +322,20 @@ class DPoint {
325
322
  if (x instanceof DPoint) {
326
323
  xV = this.x / x.x;
327
324
  yV = this.y / x.y;
328
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(x.z)) {
325
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
329
326
  zV = this.z / x.z;
330
327
  }
331
328
  }
332
329
  else {
333
330
  xV = this.x / x;
334
331
  yV = this.y / y;
335
- if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(z)) {
332
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
336
333
  zV = this.z / z;
337
334
  }
338
335
  }
339
336
  this.x = xV;
340
337
  this.y = yV;
341
- if ((0, utils_1.isDefAndNotNull)(zV)) {
338
+ if (isDefAndNotNull(zV)) {
342
339
  this.z = zV;
343
340
  }
344
341
  return this;
@@ -395,13 +392,13 @@ class DPoint {
395
392
  this.y = y;
396
393
  }
397
394
  get area() {
398
- (0, utils_1.checkFunction)('area')
395
+ checkFunction('area')
399
396
  .checkArgument('this')
400
397
  .shouldBeMeters(this);
401
398
  return this.w * this.h;
402
399
  }
403
400
  get hip() {
404
- (0, utils_1.checkFunction)('hip')
401
+ checkFunction('hip')
405
402
  .checkArgument('this')
406
403
  .shouldBeMeters(this);
407
404
  return Math.sqrt(this.w * this.w + this.h * this.h);
@@ -445,7 +442,7 @@ class DPoint {
445
442
  return this.scale(-1);
446
443
  }
447
444
  orthodromicPath(point, pointsCount = 360) {
448
- (0, utils_1.checkFunction)('orthodromicPath')
445
+ checkFunction('orthodromicPath')
449
446
  .checkArgument('this')
450
447
  .shouldBeDegree(this)
451
448
  .checkArgument('point')
@@ -454,7 +451,7 @@ class DPoint {
454
451
  const p = point.clone().degreeToRadians();
455
452
  const d = Math.sin(p.x - t.x);
456
453
  const step = (p.x - t.x) / (pointsCount - 1);
457
- return new DPolygon_1.DPolygon((0, utils_1.createArray)(pointsCount)
454
+ return new DPolygon(createArray(pointsCount)
458
455
  .map((v, i) => {
459
456
  const x = t.x + step * i;
460
457
  const y = Math.atan((Math.tan(t.y) * Math.sin(p.x - x)) / d +
@@ -473,4 +470,3 @@ class DPoint {
473
470
  .sort((a, b) => a.properties.distance - b.properties.distance);
474
471
  }
475
472
  }
476
- exports.DPoint = DPoint;