dgeoutils 2.0.2 → 2.2.2

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.
package/dist/DCircle.d.ts CHANGED
@@ -12,11 +12,31 @@ export declare class DCircle {
12
12
  clone(): DCircle;
13
13
  /**
14
14
  * Find intersection points with other circle.
15
+ *
16
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPoints.png)
15
17
  * @param c
16
18
  */
17
19
  findPoints(c: DCircle): DPoint[] | number;
18
20
  equal({ center, r }: DCircle): boolean;
21
+ /**
22
+ * Transform circle to polygon
23
+ *
24
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPolygonInside.png)
25
+ * @param [pointCount=64]
26
+ */
19
27
  findPolygonInside(pointCount?: number): DPolygon;
28
+ /**
29
+ * Transform circle to polygon on sphere. It would be different for different latitude.
30
+ *
31
+ * @remarks
32
+ * Center should be Lng/Lat.
33
+ *
34
+ * @remarks
35
+ * Radius should be in meters.
36
+ *
37
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPolygonInsideOnSphere.png)
38
+ * @param [pointCount=64]
39
+ */
20
40
  findPolygonInsideOnSphere(pointCount?: number): DPolygon;
21
41
  private sphereOffset;
22
42
  }
package/dist/DCircle.js CHANGED
@@ -23,6 +23,8 @@ class DCircle {
23
23
  }
24
24
  /**
25
25
  * Find intersection points with other circle.
26
+ *
27
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPoints.png)
26
28
  * @param c
27
29
  */
28
30
  findPoints(c) {
@@ -57,6 +59,12 @@ class DCircle {
57
59
  equal({ center, r }) {
58
60
  return this.center.equal(center) && this.r === r;
59
61
  }
62
+ /**
63
+ * Transform circle to polygon
64
+ *
65
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPolygonInside.png)
66
+ * @param [pointCount=64]
67
+ */
60
68
  findPolygonInside(pointCount = 64) {
61
69
  const preAngle = 2 * Math.PI / pointCount;
62
70
  const points = [];
@@ -68,6 +76,18 @@ class DCircle {
68
76
  }
69
77
  return new DPolygon_1.DPolygon([...points, points[0]]);
70
78
  }
79
+ /**
80
+ * Transform circle to polygon on sphere. It would be different for different latitude.
81
+ *
82
+ * @remarks
83
+ * Center should be Lng/Lat.
84
+ *
85
+ * @remarks
86
+ * Radius should be in meters.
87
+ *
88
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/findPolygonInsideOnSphere.png)
89
+ * @param [pointCount=64]
90
+ */
71
91
  findPolygonInsideOnSphere(pointCount = 64) {
72
92
  (0, utils_1.checkFunction)('findPolygonInsideOnSphere')
73
93
  .checkArgument('center')
@@ -76,7 +96,7 @@ class DCircle {
76
96
  for (let i = 0; i < pointCount; i++) {
77
97
  res.push(this.sphereOffset(2 * Math.PI * i / pointCount));
78
98
  }
79
- return res;
99
+ return res.close();
80
100
  }
81
101
  sphereOffset(bearing, earthRadius = DPoint_1.EARTH_RADIUS_IN_METERS) {
82
102
  const lat1 = DNumbers_1.DNumbers.deg2Rad(this.center.y);
package/dist/DLine.d.ts CHANGED
@@ -14,9 +14,10 @@ export declare class DLine {
14
14
  * Find intersection of two lines segments.
15
15
  * For intersection of two lines use [[findPoint]]
16
16
  * @param l
17
- * @param d
17
+ * @param [d=0]
18
+ * @param [includeOnly=false]
18
19
  */
19
- intersection(l: DLine, d?: number): DPoint | null;
20
+ intersection(l: DLine, d?: number, includeOnly?: boolean): DPoint | null;
20
21
  intersectionWithCircle(circle: DCircle): DPoint | [DPoint, DPoint] | null;
21
22
  /**
22
23
  * Check if point below to line segment
@@ -24,6 +25,13 @@ export declare class DLine {
24
25
  * @param d
25
26
  */
26
27
  inRange(p: DPoint, d?: number): boolean;
28
+ /**
29
+ * Check if point below to line segment, but not equal star or end point.
30
+ * @param p
31
+ * @param d
32
+ */
33
+ insideRange(p: DPoint, d?: number): boolean;
34
+ get center(): DPoint;
27
35
  get minX(): number;
28
36
  get minY(): number;
29
37
  get maxX(): number;
package/dist/DLine.js CHANGED
@@ -45,11 +45,15 @@ class DLine {
45
45
  * Find intersection of two lines segments.
46
46
  * For intersection of two lines use [[findPoint]]
47
47
  * @param l
48
- * @param d
48
+ * @param [d=0]
49
+ * @param [includeOnly=false]
49
50
  */
50
- intersection(l, d = 0) {
51
+ intersection(l, d = 0, includeOnly = false) {
51
52
  const p = this.findPoint(l);
52
53
  if (p) {
54
+ if (includeOnly) {
55
+ return this.insideRange(p, d) && l.insideRange(p, d) ? p : null;
56
+ }
53
57
  return this.inRange(p, d) && l.inRange(p, d) ? p : null;
54
58
  }
55
59
  return null;
@@ -117,6 +121,28 @@ class DLine {
117
121
  const isInY = y >= minY - d && y <= maxY + d;
118
122
  return isInX && isInY;
119
123
  }
124
+ /**
125
+ * Check if point below to line segment, but not equal star or end point.
126
+ * @param p
127
+ * @param d
128
+ */
129
+ insideRange(p, d = 0) {
130
+ const { p1, p2 } = this;
131
+ return this.inRange(p, d) && !p1.like(p, 0.00001) && !p2.like(p, 0.00001);
132
+ }
133
+ get center() {
134
+ return this.p1
135
+ .clone()
136
+ .setIfLessThan(this.p2)
137
+ .move(this.p2
138
+ .clone()
139
+ .move(this.p1
140
+ .clone()
141
+ .minus())
142
+ .abs()
143
+ .minus()
144
+ .divide(2));
145
+ }
120
146
  get minX() {
121
147
  return Math.min(this.p1.x, this.p2.x);
122
148
  }
package/dist/DPoint.d.ts CHANGED
@@ -1,19 +1,5 @@
1
1
  import { DLine } from './DLine';
2
2
  import { DPolygon } from './DPolygon';
3
- /**
4
- * Meters
5
- * Projected bounds:
6
- * -20026376.39 -20048966.10
7
- * 20026376.39 20048966.10
8
- */
9
- export declare const PSEUDO_MERCATOR = "EPSG:3857";
10
- /**
11
- * Degrees
12
- * Projected bounds:
13
- * -180.0 -90.0
14
- * 180.0 90.0
15
- */
16
- export declare const WORLD_GEODETIC_SYSTEM = "EPSG:4326";
17
3
  export declare const EARTH_RADIUS_IN_METERS = 6371008.8;
18
4
  export declare type DCoord = [number, number] | [number, number, number];
19
5
  export interface LatLng {
@@ -45,7 +31,21 @@ export declare class DPoint {
45
31
  static isPoint(p: unknown): boolean;
46
32
  static parseFromWKT(wkt: string): DPoint;
47
33
  static Random(): DPoint;
34
+ /**
35
+ * @remark Point should be Lng/Lat.
36
+ *
37
+ * @remark `z` value default for `zoom` argument.
38
+ *
39
+ * @param [zoom=this.z]
40
+ */
48
41
  getTileFromCoords(zoom?: number): DPoint;
42
+ /**
43
+ * Result would be Lng/Lat.
44
+ *
45
+ * @remark `z` value default for `zoom` argument.
46
+ *
47
+ * @param [zoom=this.z]
48
+ */
49
49
  getCoordsFromTile(zoom?: number): DPoint;
50
50
  toCoords(): DCoord;
51
51
  /**
@@ -54,7 +54,6 @@ export declare class DPoint {
54
54
  */
55
55
  findLine(p: DPoint): DLine;
56
56
  findInnerAngle(p1: DPoint, p3: DPoint): number;
57
- transform(from?: string, to?: string): DPoint;
58
57
  toString(): string;
59
58
  getValue(): [number, number];
60
59
  height(z: number): DPoint;
@@ -73,8 +72,12 @@ export declare class DPoint {
73
72
  */
74
73
  rotate(a: number): DPoint;
75
74
  move(x?: number | DPoint, y?: number): DPoint;
76
- asRadians(): DPoint;
77
- asDegrees(): DPoint;
75
+ degreeToMeters(): DPoint;
76
+ metersToDegree(): DPoint;
77
+ degreeToRadians(): DPoint;
78
+ radiansToDegrees(): DPoint;
79
+ radiansToMeters(): DPoint;
80
+ metersToRadians(): DPoint;
78
81
  round(): DPoint;
79
82
  ceil(): DPoint;
80
83
  floor(): DPoint;
@@ -84,6 +87,7 @@ export declare class DPoint {
84
87
  divide(x?: number | DPoint, y?: number): DPoint;
85
88
  equal(p: DPoint): boolean;
86
89
  like(p: DPoint, d?: number): boolean;
90
+ flipVertically(size: DPoint | number): DPoint;
87
91
  /**
88
92
  * Check if point looks like radians
89
93
  */
@@ -114,7 +118,15 @@ export declare class DPoint {
114
118
  };
115
119
  setIfLessThan(p: DPoint): DPoint;
116
120
  minus(): DPoint;
121
+ /**
122
+ * Find [orthodromic path](https://en.wikipedia.org/wiki/Great-circle_navigation) between to points.
123
+ *
124
+ * @remark Points should be Lng/Lat.
125
+ *
126
+ * ![example](/media/examples/orthodromicPath.png)
127
+ *
128
+ * @param point
129
+ * @param [pointsCount=360]
130
+ */
117
131
  orthodromicPath(point: DPoint, pointsCount?: number): DPolygon;
118
- private degrees2meters;
119
- private meters2degrees;
120
132
  }
package/dist/DPoint.js CHANGED
@@ -1,26 +1,12 @@
1
1
  "use strict";
2
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 = exports.WORLD_GEODETIC_SYSTEM = exports.PSEUDO_MERCATOR = void 0;
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
4
  const DLine_1 = require("./DLine");
5
5
  const DPolygon_1 = require("./DPolygon");
6
6
  const utils_1 = require("./utils");
7
7
  const diff = 0;
8
8
  const radiansPolygon = new DPolygon_1.DPolygon();
9
- /**
10
- * Meters
11
- * Projected bounds:
12
- * -20026376.39 -20048966.10
13
- * 20026376.39 20048966.10
14
- */
15
- exports.PSEUDO_MERCATOR = 'EPSG:3857';
16
9
  const pseudoMercatorPolygon = new DPolygon_1.DPolygon();
17
- /**
18
- * Degrees
19
- * Projected bounds:
20
- * -180.0 -90.0
21
- * 180.0 90.0
22
- */
23
- exports.WORLD_GEODETIC_SYSTEM = 'EPSG:4326';
24
10
  const worldGeodeticPolygon = new DPolygon_1.DPolygon();
25
11
  exports.EARTH_RADIUS_IN_METERS = 6371008.8;
26
12
  const EARTH_IN_MITERS = 20037508.34;
@@ -72,6 +58,13 @@ class DPoint {
72
58
  static Random() {
73
59
  return new DPoint(Math.random(), Math.random());
74
60
  }
61
+ /**
62
+ * @remark Point should be Lng/Lat.
63
+ *
64
+ * @remark `z` value default for `zoom` argument.
65
+ *
66
+ * @param [zoom=this.z]
67
+ */
75
68
  getTileFromCoords(zoom = this.z) {
76
69
  (0, utils_1.checkFunction)('getTileFromCoords')
77
70
  .checkArgument('this')
@@ -80,6 +73,13 @@ class DPoint {
80
73
  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)));
81
74
  return new DPoint(x, y, zoom);
82
75
  }
76
+ /**
77
+ * Result would be Lng/Lat.
78
+ *
79
+ * @remark `z` value default for `zoom` argument.
80
+ *
81
+ * @param [zoom=this.z]
82
+ */
83
83
  getCoordsFromTile(zoom = this.z) {
84
84
  (0, utils_1.checkFunction)('getCoordsFromTile')
85
85
  .checkArgument('this')
@@ -134,18 +134,6 @@ class DPoint {
134
134
  }
135
135
  return a2 + Math.PI * 2 - a1;
136
136
  }
137
- transform(from = exports.PSEUDO_MERCATOR, to = exports.WORLD_GEODETIC_SYSTEM) {
138
- if (from === to && [exports.PSEUDO_MERCATOR, exports.WORLD_GEODETIC_SYSTEM].includes(from)) {
139
- return this;
140
- }
141
- if (from === exports.PSEUDO_MERCATOR && to === exports.WORLD_GEODETIC_SYSTEM) {
142
- return this.meters2degrees();
143
- }
144
- if (from === exports.WORLD_GEODETIC_SYSTEM && to === exports.PSEUDO_MERCATOR) {
145
- return this.degrees2meters();
146
- }
147
- return this;
148
- }
149
137
  toString() {
150
138
  return `${this.x} ${this.y}`;
151
139
  }
@@ -221,18 +209,52 @@ class DPoint {
221
209
  this.y = yV;
222
210
  return this;
223
211
  }
224
- asRadians() {
225
- (0, utils_1.checkFunction)('asRadians')
212
+ degreeToMeters() {
213
+ (0, utils_1.checkFunction)('degreeToMeters')
214
+ .checkArgument('this')
215
+ .shouldBeDegree(this);
216
+ const x = ((this.x + exports.PI_IN_DEGREE) % exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
217
+ const y = (Math.log(Math.tan(((this.y + exports.HALF_PI_IN_DEGREE) % exports.PI_IN_DEGREE) *
218
+ (Math.PI / exports.DOUBLE_PI_IN_DEGREE))) / exports.PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
219
+ this.x = x;
220
+ this.y = y;
221
+ return this;
222
+ }
223
+ metersToDegree() {
224
+ (0, utils_1.checkFunction)('metersToDegree')
225
+ .checkArgument('this')
226
+ .shouldBeMeters(this);
227
+ const lon = this.x * DEGREES_IN_ONE_MITER;
228
+ const lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * exports.PI_TO_DEGREE))) *
229
+ (exports.DOUBLE_PI_IN_DEGREE / Math.PI) - exports.HALF_PI_IN_DEGREE;
230
+ this.x = lon;
231
+ this.y = lat;
232
+ return this;
233
+ }
234
+ degreeToRadians() {
235
+ (0, utils_1.checkFunction)('degreeToRadians')
226
236
  .checkArgument('this')
227
237
  .shouldBeDegree(this);
228
238
  return this.scale(exports.PI_TO_DEGREE);
229
239
  }
230
- asDegrees() {
231
- (0, utils_1.checkFunction)('asDegrees')
240
+ radiansToDegrees() {
241
+ (0, utils_1.checkFunction)('radiansToDegrees')
232
242
  .checkArgument('this')
233
243
  .shouldBeRadians(this);
234
244
  return this.scale(exports.DEGREE_TO_PI);
235
245
  }
246
+ radiansToMeters() {
247
+ (0, utils_1.checkFunction)('radiansToMeters')
248
+ .checkArgument('this')
249
+ .shouldBeRadians(this);
250
+ return this.radiansToDegrees().degreeToMeters();
251
+ }
252
+ metersToRadians() {
253
+ (0, utils_1.checkFunction)('metersToRadians')
254
+ .checkArgument('this')
255
+ .shouldBeMeters(this);
256
+ return this.metersToDegree().degreeToRadians();
257
+ }
236
258
  round() {
237
259
  this.x = Math.round(this.x);
238
260
  this.y = Math.round(this.y);
@@ -292,11 +314,22 @@ class DPoint {
292
314
  return this.x === p.x && this.y === p.y && this.z === p.z;
293
315
  }
294
316
  like(p, d = 0.001) {
317
+ if (this.equal(p)) {
318
+ return true;
319
+ }
295
320
  const likeX = Math.abs(this.x - p.x) < d;
296
321
  const likeY = Math.abs(this.y - p.y) < d;
297
- const likeZ = this.z === p.z || Math.abs(this.z - p.z) < d;
322
+ const likeZ = Math.abs((this.z || 0) - (p.z || 0)) < d;
298
323
  return likeX && likeY && likeZ;
299
324
  }
325
+ flipVertically(size) {
326
+ let v = size;
327
+ if (size instanceof DPoint) {
328
+ v = size.y;
329
+ }
330
+ this.y = v - this.y;
331
+ return this;
332
+ }
300
333
  /**
301
334
  * Check if point looks like radians
302
335
  */
@@ -386,14 +419,24 @@ class DPoint {
386
419
  minus() {
387
420
  return this.clone().scale(-1);
388
421
  }
422
+ /**
423
+ * Find [orthodromic path](https://en.wikipedia.org/wiki/Great-circle_navigation) between to points.
424
+ *
425
+ * @remark Points should be Lng/Lat.
426
+ *
427
+ * ![example](/media/examples/orthodromicPath.png)
428
+ *
429
+ * @param point
430
+ * @param [pointsCount=360]
431
+ */
389
432
  orthodromicPath(point, pointsCount = 360) {
390
433
  (0, utils_1.checkFunction)('orthodromicPath')
391
434
  .checkArgument('this')
392
435
  .shouldBeDegree(this)
393
436
  .checkArgument('point')
394
437
  .shouldBeDegree(point);
395
- const t = this.clone().asRadians();
396
- const p = point.clone().asRadians();
438
+ const t = this.clone().degreeToRadians();
439
+ const p = point.clone().degreeToRadians();
397
440
  const d = Math.sin(p.x - t.x);
398
441
  const step = (p.x - t.x) / (pointsCount - 1);
399
442
  return new DPolygon_1.DPolygon(Array.from(new Array(pointsCount))
@@ -401,30 +444,8 @@ class DPoint {
401
444
  const x = t.x + step * i;
402
445
  const y = Math.atan((Math.tan(t.y) * Math.sin(p.x - x)) / d +
403
446
  (Math.tan(p.y) * Math.sin(x - t.x)) / d);
404
- return new DPoint(x, y).asDegrees();
447
+ return new DPoint(x, y).radiansToDegrees();
405
448
  }));
406
449
  }
407
- degrees2meters() {
408
- (0, utils_1.checkFunction)('degrees2meters')
409
- .checkArgument('this')
410
- .shouldBeDegree(this);
411
- const x = ((this.x + exports.PI_IN_DEGREE) % exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
412
- const y = (Math.log(Math.tan(((this.y + exports.HALF_PI_IN_DEGREE) % exports.PI_IN_DEGREE) *
413
- (Math.PI / exports.DOUBLE_PI_IN_DEGREE))) / exports.PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
414
- this.x = x;
415
- this.y = y;
416
- return this;
417
- }
418
- meters2degrees() {
419
- (0, utils_1.checkFunction)('meters2degrees')
420
- .checkArgument('this')
421
- .shouldBeMeters(this);
422
- const lon = this.x * DEGREES_IN_ONE_MITER;
423
- const lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * exports.PI_TO_DEGREE))) *
424
- (exports.DOUBLE_PI_IN_DEGREE / Math.PI) - exports.HALF_PI_IN_DEGREE;
425
- this.x = lon;
426
- this.y = lat;
427
- return this;
428
- }
429
450
  }
430
451
  exports.DPoint = DPoint;
@@ -2,10 +2,6 @@
2
2
  import { DCoord, DPoint, LatLng } from './DPoint';
3
3
  import { DLine } from './DLine';
4
4
  import { DPolygonLoop } from './DPolygonLoop';
5
- interface ParseProps {
6
- dataProjection: string;
7
- featureProjection: string;
8
- }
9
5
  export declare const MIN_POINTS_IN_VALID_POLYGON = 3;
10
6
  export declare class DPolygon {
11
7
  properties: {
@@ -30,7 +26,7 @@ export declare class DPolygon {
30
26
  * @param poly should be `minAreaRectangle`
31
27
  */
32
28
  static minAreaRectangleDirection(poly: DPolygon): number;
33
- static parseFromWKT(wkt: string, optProps?: ParseProps): DPolygon;
29
+ static parseFromWKT(wkt: string): DPolygon;
34
30
  static createSquareBySize(size: DPoint): DPolygon;
35
31
  loop(): DPolygonLoop;
36
32
  set points(p: DPoint[]);
@@ -134,8 +130,9 @@ export declare class DPolygon {
134
130
  /**
135
131
  * Check polygon intersection with line
136
132
  * @param l
133
+ * @param [includeOnly=false]
137
134
  */
138
- intersection(l: DLine): DPoint[];
135
+ intersection(l: DLine, includeOnly?: boolean): DPoint[];
139
136
  /**
140
137
  * Set polygon center
141
138
  * @param newCenter
@@ -145,6 +142,7 @@ export declare class DPolygon {
145
142
  /**
146
143
  * Rotate polygon with center in point {0, 0}
147
144
  * @param a Radians
145
+ * @deprecated Better to use loop
148
146
  */
149
147
  rotate(a: number): DPolygon;
150
148
  /**
@@ -152,22 +150,70 @@ export declare class DPolygon {
152
150
  * @param f
153
151
  */
154
152
  filter(f: (p: DPoint) => boolean): DPolygon;
153
+ /**
154
+ * @deprecated Better to use loop
155
+ * @param [x=0]
156
+ * @param [y=x]
157
+ */
155
158
  move(x?: number | DPoint, y?: number): DPolygon;
159
+ /**
160
+ * @deprecated Better to use loop
161
+ * @param [x=0]
162
+ * @param [y=x]
163
+ */
156
164
  scale(x?: number | DPoint, y?: number): DPolygon;
165
+ /**
166
+ * @deprecated Better to use loop
167
+ * @param [x=0]
168
+ * @param [y=x]
169
+ */
157
170
  divide(x?: number | DPoint, y?: number): DPolygon;
171
+ /**
172
+ * @deprecated Better to use loop
173
+ */
158
174
  round(): DPolygon;
175
+ /**
176
+ * @deprecated Better to use loop
177
+ */
159
178
  floor(): DPolygon;
179
+ /**
180
+ * @deprecated Better to use loop
181
+ */
160
182
  ceil(): DPolygon;
183
+ /**
184
+ * @deprecated Better to use loop
185
+ * @param size
186
+ */
187
+ flipVertically(size: DPoint | number): DPolygon;
188
+ /**
189
+ * @deprecated Better to use loop
190
+ * @param [n=2]
191
+ */
161
192
  toFixed(n?: number): DPolygon;
162
193
  map(f: (r: DPoint, index?: number) => DPoint): DPolygon;
163
- p(index: number, divide?: boolean): DPoint;
194
+ at(index: number): DPoint;
164
195
  pop(): DPoint;
165
196
  push(...args: DPoint[]): number;
166
197
  shift(): DPoint;
167
198
  unshift(...args: DPoint[]): number;
168
199
  reverse(): DPolygon;
169
200
  getValue(): string;
170
- transform(from?: string, to?: string): DPolygon;
201
+ /**
202
+ * @deprecated Better to use loop
203
+ */
204
+ degreeToMeters(): DPolygon;
205
+ /**
206
+ * @deprecated Better to use loop
207
+ */
208
+ metersToDegree(): DPolygon;
209
+ /**
210
+ * @deprecated Better to use loop
211
+ */
212
+ radiansToMeters(): DPolygon;
213
+ /**
214
+ * @deprecated Better to use loop
215
+ */
216
+ metersToRadians(): DPolygon;
171
217
  toString(): string;
172
218
  /**
173
219
  * Add to the end of polygon point equal to first point if it not exist
@@ -180,6 +226,7 @@ export declare class DPolygon {
180
226
  /**
181
227
  * Set `height` (`z`)
182
228
  * @param z
229
+ * @deprecated Better to use loop
183
230
  */
184
231
  height(z: number): DPolygon;
185
232
  add(poly: DPolygon): DPolygon;
@@ -266,6 +313,12 @@ export declare class DPolygon {
266
313
  simpleIntersection(p: DPolygon): DPolygon | null | DPolygon[];
267
314
  simpleDifference(p: DPolygon): DPolygon | null | DPolygon[];
268
315
  smartUnion(p: DPolygon): DPolygon | null;
316
+ /**
317
+ * Divide polygon to triangles
318
+ *
319
+ * ![Example](https://edejin.github.io/DGeoUtils/media/examples/toTriangles.png)
320
+ */
321
+ toTriangles(): DPolygon[];
269
322
  private simpleIncludeX;
270
323
  private simpleIncludeY;
271
324
  private douglasPeucker;
@@ -274,4 +327,3 @@ export declare class DPolygon {
274
327
  private getJSTSGeometry;
275
328
  private simpleLogicFunction;
276
329
  }
277
- export {};