dgeoutils 2.4.10 → 2.4.13

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.
@@ -32,138 +32,153 @@ var LoopFunctions;
32
32
  LoopFunctions[LoopFunctions["degreeToMeters"] = 29] = "degreeToMeters";
33
33
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
34
34
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
35
+ LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
36
+ LoopFunctions[LoopFunctions["div"] = 33] = "div";
37
+ LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
35
38
  })(LoopFunctions || (LoopFunctions = {}));
36
- const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg }) => {
39
+ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg, setterArgByObject }) => {
37
40
  let res = a;
38
41
  switch (functionName) {
39
42
  case LoopFunctions.getTileFromCoords:
40
- res = (k) => a(k)
43
+ res = (k, index) => a(k, index)
41
44
  .getTileFromCoords(numberArg);
42
45
  break;
43
46
  case LoopFunctions.getCoordsFromTile:
44
- res = (k) => a(k)
47
+ res = (k, index) => a(k, index)
45
48
  .getCoordsFromTile(numberArg);
46
49
  break;
47
50
  case LoopFunctions.height:
48
- res = (k) => a(k)
51
+ res = (k, index) => a(k, index)
49
52
  .height(numberArg);
50
53
  break;
51
54
  case LoopFunctions.setX:
52
- res = (k) => a(k)
53
- .setX(setterArg);
55
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
56
+ .setX(setterArg) : a(k, index).setX((p) => setterArg(p, index));
54
57
  break;
55
58
  case LoopFunctions.setY:
56
- res = (k) => a(k)
57
- .setY(setterArg);
59
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
60
+ .setY(setterArg) : a(k, index).setY((p) => setterArg(p, index));
58
61
  break;
59
62
  case LoopFunctions.setZ:
60
- res = (k) => a(k)
61
- .setZ(setterArg);
63
+ res = (k, index) => typeof setterArg === 'number' ? a(k, index)
64
+ .setZ(setterArg) : a(k, index).setZ((p) => setterArg(p, index));
62
65
  break;
63
66
  case LoopFunctions.rotate:
64
- res = (k) => a(k)
67
+ res = (k, index) => a(k, index)
65
68
  .rotate(numberArg);
66
69
  break;
67
70
  case LoopFunctions.rotate3dX:
68
- res = (k) => a(k)
71
+ res = (k, index) => a(k, index)
69
72
  .rotate3dX(numberArg);
70
73
  break;
71
74
  case LoopFunctions.rotate3dY:
72
- res = (k) => a(k)
75
+ res = (k, index) => a(k, index)
73
76
  .rotate3dY(numberArg);
74
77
  break;
75
78
  case LoopFunctions.rotate3dZ:
76
- res = (k) => a(k)
79
+ res = (k, index) => a(k, index)
77
80
  .rotate3dZ(numberArg);
78
81
  break;
79
82
  case LoopFunctions.move:
80
- res = (k) => a(k)
83
+ res = (k, index) => a(k, index)
81
84
  .move(numberPointArg, numberArg);
82
85
  break;
83
86
  case LoopFunctions.round:
84
- res = (k) => a(k)
87
+ res = (k, index) => a(k, index)
85
88
  .round();
86
89
  break;
87
90
  case LoopFunctions.ceil:
88
- res = (k) => a(k)
91
+ res = (k, index) => a(k, index)
89
92
  .ceil();
90
93
  break;
91
94
  case LoopFunctions.floor:
92
- res = (k) => a(k)
95
+ res = (k, index) => a(k, index)
93
96
  .floor();
94
97
  break;
95
98
  case LoopFunctions.toFixed:
96
- res = (k) => a(k)
99
+ res = (k, index) => a(k, index)
97
100
  .toFixed(numberArg);
98
101
  break;
99
102
  case LoopFunctions.abs:
100
- res = (k) => a(k)
103
+ res = (k, index) => a(k, index)
101
104
  .abs();
102
105
  break;
103
106
  case LoopFunctions.scale:
104
- res = (k) => a(k)
107
+ res = (k, index) => a(k, index)
105
108
  .scale(numberPointArg, numberArg);
106
109
  break;
107
110
  case LoopFunctions.divide:
108
- res = (k) => a(k)
111
+ res = (k, index) => a(k, index)
109
112
  .divide(numberPointArg, numberArg);
110
113
  break;
114
+ case LoopFunctions.div:
115
+ res = (k, index) => a(k, index)
116
+ .div(numberPointArg, numberArg);
117
+ break;
118
+ case LoopFunctions.mod:
119
+ res = (k, index) => a(k, index)
120
+ .mod(numberPointArg, numberArg);
121
+ break;
111
122
  case LoopFunctions.degreeToRadians:
112
- res = (k) => a(k)
123
+ res = (k, index) => a(k, index)
113
124
  .degreeToRadians();
114
125
  break;
115
126
  case LoopFunctions.radiansToDegrees:
116
- res = (k) => a(k)
127
+ res = (k, index) => a(k, index)
117
128
  .radiansToDegrees();
118
129
  break;
119
130
  case LoopFunctions.radiansToMeters:
120
- res = (k) => a(k)
131
+ res = (k, index) => a(k, index)
121
132
  .radiansToMeters();
122
133
  break;
123
134
  case LoopFunctions.metersToRadians:
124
- res = (k) => a(k)
135
+ res = (k, index) => a(k, index)
125
136
  .metersToRadians();
126
137
  break;
127
138
  case LoopFunctions.hipPoint:
128
- res = (k) => a(k)
139
+ res = (k, index) => a(k, index)
129
140
  .hipPoint;
130
141
  break;
131
142
  case LoopFunctions.xPoint:
132
- res = (k) => a(k)
143
+ res = (k, index) => a(k, index)
133
144
  .xPoint;
134
145
  break;
135
146
  case LoopFunctions.yPoint:
136
- res = (k) => a(k)
147
+ res = (k, index) => a(k, index)
137
148
  .yPoint;
138
149
  break;
139
150
  case LoopFunctions.wPoint:
140
- res = (k) => a(k)
151
+ res = (k, index) => a(k, index)
141
152
  .wPoint;
142
153
  break;
143
154
  case LoopFunctions.hPoint:
144
- res = (k) => a(k)
155
+ res = (k, index) => a(k, index)
145
156
  .hPoint;
146
157
  break;
147
158
  case LoopFunctions.setIfLessThan:
148
- res = (k) => a(k)
159
+ res = (k, index) => a(k, index)
149
160
  .setIfLessThan(pointArg);
150
161
  break;
151
162
  case LoopFunctions.minus:
152
- res = (k) => a(k)
163
+ res = (k, index) => a(k, index)
153
164
  .minus();
154
165
  break;
155
166
  case LoopFunctions.degreeToMeters:
156
- res = (k) => a(k)
167
+ res = (k, index) => a(k, index)
157
168
  .degreeToMeters();
158
169
  break;
159
170
  case LoopFunctions.metersToDegree:
160
- res = (k) => a(k)
171
+ res = (k, index) => a(k, index)
161
172
  .metersToDegree();
162
173
  break;
163
174
  case LoopFunctions.flipVertically:
164
- res = (k) => a(k)
175
+ res = (k, index) => a(k, index)
165
176
  .flipVertically(numberPointArg);
166
177
  break;
178
+ case LoopFunctions.setProperties:
179
+ res = (k, index) => typeof setterArgByObject === 'object' ? a(k, index)
180
+ .setProperties(setterArgByObject) : a(k, index).setProperties((p) => setterArgByObject(p, index));
181
+ break;
167
182
  }
168
183
  return res;
169
184
  };
@@ -206,6 +221,13 @@ export class DPolygonLoop {
206
221
  });
207
222
  return this;
208
223
  }
224
+ setProperties(setterArgByObject) {
225
+ this.pool.push({
226
+ functionName: LoopFunctions.setProperties,
227
+ setterArgByObject
228
+ });
229
+ return this;
230
+ }
209
231
  setY(y) {
210
232
  this.pool.push({
211
233
  functionName: LoopFunctions.setY,
@@ -303,6 +325,22 @@ export class DPolygonLoop {
303
325
  });
304
326
  return this;
305
327
  }
328
+ div(x, y) {
329
+ this.pool.push({
330
+ functionName: LoopFunctions.div,
331
+ numberPointArg: x,
332
+ numberArg: y
333
+ });
334
+ return this;
335
+ }
336
+ mod(x, y) {
337
+ this.pool.push({
338
+ functionName: LoopFunctions.mod,
339
+ numberPointArg: x,
340
+ numberArg: y
341
+ });
342
+ return this;
343
+ }
306
344
  degreeToRadians() {
307
345
  this.pool.push({
308
346
  functionName: LoopFunctions.degreeToRadians
@@ -160,3 +160,4 @@ export const getCombinations = (arr) => {
160
160
  }
161
161
  return ans;
162
162
  };
163
+ export const div = (a, b) => Math.floor(a / b);
@@ -27,16 +27,16 @@ var __read = (this && this.__read) || function (o, n) {
27
27
  };
28
28
  import { DLine } from './DLine';
29
29
  import { DPolygon } from './DPolygon';
30
- import { checkFunction, createArray, isDefAndNotNull } from './utils';
30
+ import { checkFunction, createArray, div, isDefAndNotNull } from './utils';
31
31
  var diff = 0;
32
32
  var radiansPolygon = new DPolygon();
33
33
  var pseudoMercatorPolygon = new DPolygon();
34
34
  var worldGeodeticPolygon = new DPolygon();
35
- export var EARTH_RADIUS_IN_METERS = 6371008.8;
36
- var EARTH_IN_MITERS = 20037508.34;
35
+ export var EARTH_RADIUS_IN_METERS = 6378137;
36
+ var EARTH_IN_METERS = 20037508.34;
37
37
  var DEGREES_IN_EARTH = 180;
38
- var MITERS_IN_ONE_DEGREE = EARTH_IN_MITERS / DEGREES_IN_EARTH;
39
- var DEGREES_IN_ONE_MITER = DEGREES_IN_EARTH / EARTH_IN_MITERS;
38
+ var METERS_IN_ONE_DEGREE = EARTH_IN_METERS / DEGREES_IN_EARTH;
39
+ var DEGREES_IN_ONE_METER = DEGREES_IN_EARTH / EARTH_IN_METERS;
40
40
  export var HALF_PI_IN_DEGREE = 90;
41
41
  export var PI_IN_DEGREE = 180;
42
42
  export var DOUBLE_PI_IN_DEGREE = 360;
@@ -256,6 +256,10 @@ var DPoint = (function () {
256
256
  this.y = typeof y === 'number' ? y : y(this);
257
257
  return this;
258
258
  };
259
+ DPoint.prototype.setProperties = function (v) {
260
+ this.properties = typeof v === 'object' ? v : v(this);
261
+ return this;
262
+ };
259
263
  DPoint.prototype.clone = function () {
260
264
  var p = new DPoint(this.x, this.y, this.z);
261
265
  p.properties = __assign({}, this.properties);
@@ -328,9 +332,9 @@ var DPoint = (function () {
328
332
  checkFunction('degreeToMeters')
329
333
  .checkArgument('this')
330
334
  .shouldBeDegree(this);
331
- var x = ((this.x + PI_IN_DEGREE) % DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
335
+ var x = ((this.x + PI_IN_DEGREE) % DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE) * METERS_IN_ONE_DEGREE;
332
336
  var y = (Math.log(Math.tan(((this.y + HALF_PI_IN_DEGREE) % PI_IN_DEGREE) *
333
- (Math.PI / DOUBLE_PI_IN_DEGREE))) / PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
337
+ (Math.PI / DOUBLE_PI_IN_DEGREE))) / PI_TO_DEGREE) * METERS_IN_ONE_DEGREE;
334
338
  this.x = x;
335
339
  this.y = y;
336
340
  return this;
@@ -339,8 +343,8 @@ var DPoint = (function () {
339
343
  checkFunction('metersToDegree')
340
344
  .checkArgument('this')
341
345
  .shouldBeMeters(this);
342
- var lon = this.x * DEGREES_IN_ONE_MITER;
343
- var lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * PI_TO_DEGREE))) *
346
+ var lon = this.x * DEGREES_IN_ONE_METER;
347
+ var lat = Math.atan(Math.pow(Math.E, ((this.y / METERS_IN_ONE_DEGREE) * PI_TO_DEGREE))) *
344
348
  (DOUBLE_PI_IN_DEGREE / Math.PI) - HALF_PI_IN_DEGREE;
345
349
  this.x = lon;
346
350
  this.y = lat;
@@ -448,6 +452,58 @@ var DPoint = (function () {
448
452
  }
449
453
  return this;
450
454
  };
455
+ DPoint.prototype.mod = function (x, y, z) {
456
+ if (y === void 0) { y = x; }
457
+ var xV = 0;
458
+ var yV = 0;
459
+ var zV = undefined;
460
+ if (x instanceof DPoint) {
461
+ xV = this.x % x.x;
462
+ yV = this.y % x.y;
463
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
464
+ zV = this.z % x.z;
465
+ }
466
+ }
467
+ else {
468
+ xV = this.x % x;
469
+ yV = this.y % y;
470
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
471
+ zV = this.z % z;
472
+ }
473
+ }
474
+ this.x = xV;
475
+ this.y = yV;
476
+ if (isDefAndNotNull(zV)) {
477
+ this.z = zV;
478
+ }
479
+ return this;
480
+ };
481
+ DPoint.prototype.div = function (x, y, z) {
482
+ if (y === void 0) { y = x; }
483
+ var xV = 0;
484
+ var yV = 0;
485
+ var zV = undefined;
486
+ if (x instanceof DPoint) {
487
+ xV = div(this.x, x.x);
488
+ yV = div(this.y, x.y);
489
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
490
+ zV = div(this.z, x.z);
491
+ }
492
+ }
493
+ else {
494
+ xV = div(this.x, x);
495
+ yV = div(this.y, y);
496
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
497
+ zV = div(this.z, z);
498
+ }
499
+ }
500
+ this.x = xV;
501
+ this.y = yV;
502
+ if (isDefAndNotNull(zV)) {
503
+ this.z = zV;
504
+ }
505
+ return this;
506
+ };
451
507
  DPoint.prototype.equal = function (p) {
452
508
  return this.x === p.x && this.y === p.y && this.z === p.z;
453
509
  };
@@ -679,6 +735,27 @@ var DPoint = (function () {
679
735
  })
680
736
  .sort(function (a, b) { return a.properties.distance - b.properties.distance; });
681
737
  };
738
+ DPoint.prototype.calculateAltitudeByDistanceBetweenPoints = function (p1, p2) {
739
+ var _a, _b, _c, _d;
740
+ if (p1.alt === p2.alt) {
741
+ this.alt = p1.alt;
742
+ }
743
+ else {
744
+ var minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
745
+ var maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
746
+ var dAlt = maxAlt - minAlt;
747
+ var distance1 = this.distance(p1);
748
+ var distance2 = this.distance(p2);
749
+ var totalDistance = distance1 + distance2;
750
+ if (p1.alt === minAlt) {
751
+ this.alt = minAlt + distance1 / totalDistance * dAlt;
752
+ }
753
+ else {
754
+ this.alt = minAlt + distance2 / totalDistance * dAlt;
755
+ }
756
+ }
757
+ return this;
758
+ };
682
759
  return DPoint;
683
760
  }());
684
761
  export { DPoint };
@@ -32,139 +32,154 @@ var LoopFunctions;
32
32
  LoopFunctions[LoopFunctions["degreeToMeters"] = 29] = "degreeToMeters";
33
33
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
34
34
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
35
+ LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
36
+ LoopFunctions[LoopFunctions["div"] = 33] = "div";
37
+ LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
35
38
  })(LoopFunctions || (LoopFunctions = {}));
36
39
  var decodePoolRecord = function (a, _a) {
37
- var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg;
40
+ var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg, setterArgByObject = _a.setterArgByObject;
38
41
  var res = a;
39
42
  switch (functionName) {
40
43
  case LoopFunctions.getTileFromCoords:
41
- res = function (k) { return a(k)
44
+ res = function (k, index) { return a(k, index)
42
45
  .getTileFromCoords(numberArg); };
43
46
  break;
44
47
  case LoopFunctions.getCoordsFromTile:
45
- res = function (k) { return a(k)
48
+ res = function (k, index) { return a(k, index)
46
49
  .getCoordsFromTile(numberArg); };
47
50
  break;
48
51
  case LoopFunctions.height:
49
- res = function (k) { return a(k)
52
+ res = function (k, index) { return a(k, index)
50
53
  .height(numberArg); };
51
54
  break;
52
55
  case LoopFunctions.setX:
53
- res = function (k) { return a(k)
54
- .setX(setterArg); };
56
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
57
+ .setX(setterArg) : a(k, index).setX(function (p) { return setterArg(p, index); }); };
55
58
  break;
56
59
  case LoopFunctions.setY:
57
- res = function (k) { return a(k)
58
- .setY(setterArg); };
60
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
61
+ .setY(setterArg) : a(k, index).setY(function (p) { return setterArg(p, index); }); };
59
62
  break;
60
63
  case LoopFunctions.setZ:
61
- res = function (k) { return a(k)
62
- .setZ(setterArg); };
64
+ res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
65
+ .setZ(setterArg) : a(k, index).setZ(function (p) { return setterArg(p, index); }); };
63
66
  break;
64
67
  case LoopFunctions.rotate:
65
- res = function (k) { return a(k)
68
+ res = function (k, index) { return a(k, index)
66
69
  .rotate(numberArg); };
67
70
  break;
68
71
  case LoopFunctions.rotate3dX:
69
- res = function (k) { return a(k)
72
+ res = function (k, index) { return a(k, index)
70
73
  .rotate3dX(numberArg); };
71
74
  break;
72
75
  case LoopFunctions.rotate3dY:
73
- res = function (k) { return a(k)
76
+ res = function (k, index) { return a(k, index)
74
77
  .rotate3dY(numberArg); };
75
78
  break;
76
79
  case LoopFunctions.rotate3dZ:
77
- res = function (k) { return a(k)
80
+ res = function (k, index) { return a(k, index)
78
81
  .rotate3dZ(numberArg); };
79
82
  break;
80
83
  case LoopFunctions.move:
81
- res = function (k) { return a(k)
84
+ res = function (k, index) { return a(k, index)
82
85
  .move(numberPointArg, numberArg); };
83
86
  break;
84
87
  case LoopFunctions.round:
85
- res = function (k) { return a(k)
88
+ res = function (k, index) { return a(k, index)
86
89
  .round(); };
87
90
  break;
88
91
  case LoopFunctions.ceil:
89
- res = function (k) { return a(k)
92
+ res = function (k, index) { return a(k, index)
90
93
  .ceil(); };
91
94
  break;
92
95
  case LoopFunctions.floor:
93
- res = function (k) { return a(k)
96
+ res = function (k, index) { return a(k, index)
94
97
  .floor(); };
95
98
  break;
96
99
  case LoopFunctions.toFixed:
97
- res = function (k) { return a(k)
100
+ res = function (k, index) { return a(k, index)
98
101
  .toFixed(numberArg); };
99
102
  break;
100
103
  case LoopFunctions.abs:
101
- res = function (k) { return a(k)
104
+ res = function (k, index) { return a(k, index)
102
105
  .abs(); };
103
106
  break;
104
107
  case LoopFunctions.scale:
105
- res = function (k) { return a(k)
108
+ res = function (k, index) { return a(k, index)
106
109
  .scale(numberPointArg, numberArg); };
107
110
  break;
108
111
  case LoopFunctions.divide:
109
- res = function (k) { return a(k)
112
+ res = function (k, index) { return a(k, index)
110
113
  .divide(numberPointArg, numberArg); };
111
114
  break;
115
+ case LoopFunctions.div:
116
+ res = function (k, index) { return a(k, index)
117
+ .div(numberPointArg, numberArg); };
118
+ break;
119
+ case LoopFunctions.mod:
120
+ res = function (k, index) { return a(k, index)
121
+ .mod(numberPointArg, numberArg); };
122
+ break;
112
123
  case LoopFunctions.degreeToRadians:
113
- res = function (k) { return a(k)
124
+ res = function (k, index) { return a(k, index)
114
125
  .degreeToRadians(); };
115
126
  break;
116
127
  case LoopFunctions.radiansToDegrees:
117
- res = function (k) { return a(k)
128
+ res = function (k, index) { return a(k, index)
118
129
  .radiansToDegrees(); };
119
130
  break;
120
131
  case LoopFunctions.radiansToMeters:
121
- res = function (k) { return a(k)
132
+ res = function (k, index) { return a(k, index)
122
133
  .radiansToMeters(); };
123
134
  break;
124
135
  case LoopFunctions.metersToRadians:
125
- res = function (k) { return a(k)
136
+ res = function (k, index) { return a(k, index)
126
137
  .metersToRadians(); };
127
138
  break;
128
139
  case LoopFunctions.hipPoint:
129
- res = function (k) { return a(k)
140
+ res = function (k, index) { return a(k, index)
130
141
  .hipPoint; };
131
142
  break;
132
143
  case LoopFunctions.xPoint:
133
- res = function (k) { return a(k)
144
+ res = function (k, index) { return a(k, index)
134
145
  .xPoint; };
135
146
  break;
136
147
  case LoopFunctions.yPoint:
137
- res = function (k) { return a(k)
148
+ res = function (k, index) { return a(k, index)
138
149
  .yPoint; };
139
150
  break;
140
151
  case LoopFunctions.wPoint:
141
- res = function (k) { return a(k)
152
+ res = function (k, index) { return a(k, index)
142
153
  .wPoint; };
143
154
  break;
144
155
  case LoopFunctions.hPoint:
145
- res = function (k) { return a(k)
156
+ res = function (k, index) { return a(k, index)
146
157
  .hPoint; };
147
158
  break;
148
159
  case LoopFunctions.setIfLessThan:
149
- res = function (k) { return a(k)
160
+ res = function (k, index) { return a(k, index)
150
161
  .setIfLessThan(pointArg); };
151
162
  break;
152
163
  case LoopFunctions.minus:
153
- res = function (k) { return a(k)
164
+ res = function (k, index) { return a(k, index)
154
165
  .minus(); };
155
166
  break;
156
167
  case LoopFunctions.degreeToMeters:
157
- res = function (k) { return a(k)
168
+ res = function (k, index) { return a(k, index)
158
169
  .degreeToMeters(); };
159
170
  break;
160
171
  case LoopFunctions.metersToDegree:
161
- res = function (k) { return a(k)
172
+ res = function (k, index) { return a(k, index)
162
173
  .metersToDegree(); };
163
174
  break;
164
175
  case LoopFunctions.flipVertically:
165
- res = function (k) { return a(k)
176
+ res = function (k, index) { return a(k, index)
166
177
  .flipVertically(numberPointArg); };
167
178
  break;
179
+ case LoopFunctions.setProperties:
180
+ res = function (k, index) { return typeof setterArgByObject === 'object' ? a(k, index)
181
+ .setProperties(setterArgByObject) : a(k, index).setProperties(function (p) { return setterArgByObject(p, index); }); };
182
+ break;
168
183
  }
169
184
  return res;
170
185
  };
@@ -207,6 +222,13 @@ var DPolygonLoop = (function () {
207
222
  });
208
223
  return this;
209
224
  };
225
+ DPolygonLoop.prototype.setProperties = function (setterArgByObject) {
226
+ this.pool.push({
227
+ functionName: LoopFunctions.setProperties,
228
+ setterArgByObject: setterArgByObject
229
+ });
230
+ return this;
231
+ };
210
232
  DPolygonLoop.prototype.setY = function (y) {
211
233
  this.pool.push({
212
234
  functionName: LoopFunctions.setY,
@@ -307,6 +329,22 @@ var DPolygonLoop = (function () {
307
329
  });
308
330
  return this;
309
331
  };
332
+ DPolygonLoop.prototype.div = function (x, y) {
333
+ this.pool.push({
334
+ functionName: LoopFunctions.div,
335
+ numberPointArg: x,
336
+ numberArg: y
337
+ });
338
+ return this;
339
+ };
340
+ DPolygonLoop.prototype.mod = function (x, y) {
341
+ this.pool.push({
342
+ functionName: LoopFunctions.mod,
343
+ numberPointArg: x,
344
+ numberArg: y
345
+ });
346
+ return this;
347
+ };
310
348
  DPolygonLoop.prototype.degreeToRadians = function () {
311
349
  this.pool.push({
312
350
  functionName: LoopFunctions.degreeToRadians
package/dist/esm/utils.js CHANGED
@@ -202,3 +202,4 @@ export var getCombinations = function (arr) {
202
202
  }
203
203
  return ans;
204
204
  };
205
+ export var div = function (a, b) { return Math.floor(a / b); };