dgeoutils 2.4.12 → 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.
@@ -1,7 +1,7 @@
1
1
  import { DLine } from './DLine';
2
2
  import { DPolygon } from './DPolygon';
3
3
  import { Point } from 'geojson';
4
- export declare const EARTH_RADIUS_IN_METERS = 6371008.8;
4
+ export declare const EARTH_RADIUS_IN_METERS = 6378137;
5
5
  export declare type DCoord = [number, number] | [number, number, number];
6
6
  export interface LatLng {
7
7
  lat: number;
@@ -83,6 +83,14 @@ export declare class DPoint {
83
83
  divide(p: DPoint): DPoint;
84
84
  divide(x: number, y: number): DPoint;
85
85
  divide(x: number, y: number, z: number): DPoint;
86
+ mod(v: number): DPoint;
87
+ mod(p: DPoint): DPoint;
88
+ mod(x: number, y: number): DPoint;
89
+ mod(x: number, y: number, z: number): DPoint;
90
+ div(v: number): DPoint;
91
+ div(p: DPoint): DPoint;
92
+ div(x: number, y: number): DPoint;
93
+ div(x: number, y: number, z: number): DPoint;
86
94
  equal(p: DPoint): boolean;
87
95
  like(p: DPoint, d?: number): boolean;
88
96
  flipVertically(size: DPoint): DPoint;
@@ -35,11 +35,11 @@ var diff = 0;
35
35
  var radiansPolygon = new DPolygon_1.DPolygon();
36
36
  var pseudoMercatorPolygon = new DPolygon_1.DPolygon();
37
37
  var worldGeodeticPolygon = new DPolygon_1.DPolygon();
38
- exports.EARTH_RADIUS_IN_METERS = 6371008.8;
39
- var EARTH_IN_MITERS = 20037508.34;
38
+ exports.EARTH_RADIUS_IN_METERS = 6378137;
39
+ var EARTH_IN_METERS = 20037508.34;
40
40
  var DEGREES_IN_EARTH = 180;
41
- var MITERS_IN_ONE_DEGREE = EARTH_IN_MITERS / DEGREES_IN_EARTH;
42
- var DEGREES_IN_ONE_MITER = DEGREES_IN_EARTH / EARTH_IN_MITERS;
41
+ var METERS_IN_ONE_DEGREE = EARTH_IN_METERS / DEGREES_IN_EARTH;
42
+ var DEGREES_IN_ONE_METER = DEGREES_IN_EARTH / EARTH_IN_METERS;
43
43
  exports.HALF_PI_IN_DEGREE = 90;
44
44
  exports.PI_IN_DEGREE = 180;
45
45
  exports.DOUBLE_PI_IN_DEGREE = 360;
@@ -335,9 +335,9 @@ var DPoint = (function () {
335
335
  (0, utils_1.checkFunction)('degreeToMeters')
336
336
  .checkArgument('this')
337
337
  .shouldBeDegree(this);
338
- var x = ((this.x + exports.PI_IN_DEGREE) % exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
338
+ var x = ((this.x + exports.PI_IN_DEGREE) % exports.DOUBLE_PI_IN_DEGREE - exports.PI_IN_DEGREE) * METERS_IN_ONE_DEGREE;
339
339
  var y = (Math.log(Math.tan(((this.y + exports.HALF_PI_IN_DEGREE) % exports.PI_IN_DEGREE) *
340
- (Math.PI / exports.DOUBLE_PI_IN_DEGREE))) / exports.PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
340
+ (Math.PI / exports.DOUBLE_PI_IN_DEGREE))) / exports.PI_TO_DEGREE) * METERS_IN_ONE_DEGREE;
341
341
  this.x = x;
342
342
  this.y = y;
343
343
  return this;
@@ -346,8 +346,8 @@ var DPoint = (function () {
346
346
  (0, utils_1.checkFunction)('metersToDegree')
347
347
  .checkArgument('this')
348
348
  .shouldBeMeters(this);
349
- var lon = this.x * DEGREES_IN_ONE_MITER;
350
- var lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * exports.PI_TO_DEGREE))) *
349
+ var lon = this.x * DEGREES_IN_ONE_METER;
350
+ var lat = Math.atan(Math.pow(Math.E, ((this.y / METERS_IN_ONE_DEGREE) * exports.PI_TO_DEGREE))) *
351
351
  (exports.DOUBLE_PI_IN_DEGREE / Math.PI) - exports.HALF_PI_IN_DEGREE;
352
352
  this.x = lon;
353
353
  this.y = lat;
@@ -455,6 +455,58 @@ var DPoint = (function () {
455
455
  }
456
456
  return this;
457
457
  };
458
+ DPoint.prototype.mod = function (x, y, z) {
459
+ if (y === void 0) { y = x; }
460
+ var xV = 0;
461
+ var yV = 0;
462
+ var zV = undefined;
463
+ if (x instanceof DPoint) {
464
+ xV = this.x % x.x;
465
+ yV = this.y % x.y;
466
+ if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(x.z)) {
467
+ zV = this.z % x.z;
468
+ }
469
+ }
470
+ else {
471
+ xV = this.x % x;
472
+ yV = this.y % y;
473
+ if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(z)) {
474
+ zV = this.z % z;
475
+ }
476
+ }
477
+ this.x = xV;
478
+ this.y = yV;
479
+ if ((0, utils_1.isDefAndNotNull)(zV)) {
480
+ this.z = zV;
481
+ }
482
+ return this;
483
+ };
484
+ DPoint.prototype.div = function (x, y, z) {
485
+ if (y === void 0) { y = x; }
486
+ var xV = 0;
487
+ var yV = 0;
488
+ var zV = undefined;
489
+ if (x instanceof DPoint) {
490
+ xV = (0, utils_1.div)(this.x, x.x);
491
+ yV = (0, utils_1.div)(this.y, x.y);
492
+ if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(x.z)) {
493
+ zV = (0, utils_1.div)(this.z, x.z);
494
+ }
495
+ }
496
+ else {
497
+ xV = (0, utils_1.div)(this.x, x);
498
+ yV = (0, utils_1.div)(this.y, y);
499
+ if ((0, utils_1.isDefAndNotNull)(this.z) && (0, utils_1.isDefAndNotNull)(z)) {
500
+ zV = (0, utils_1.div)(this.z, z);
501
+ }
502
+ }
503
+ this.x = xV;
504
+ this.y = yV;
505
+ if ((0, utils_1.isDefAndNotNull)(zV)) {
506
+ this.z = zV;
507
+ }
508
+ return this;
509
+ };
458
510
  DPoint.prototype.equal = function (p) {
459
511
  return this.x === p.x && this.y === p.y && this.z === p.z;
460
512
  };
@@ -36,6 +36,12 @@ export declare class DPolygonLoop {
36
36
  divide(v: number): DPolygonLoop;
37
37
  divide(p: DPoint): DPolygonLoop;
38
38
  divide(x: number, y: number): DPolygonLoop;
39
+ div(v: number): DPolygonLoop;
40
+ div(p: DPoint): DPolygonLoop;
41
+ div(x: number, y: number): DPolygonLoop;
42
+ mod(v: number): DPolygonLoop;
43
+ mod(p: DPoint): DPolygonLoop;
44
+ mod(x: number, y: number): DPolygonLoop;
39
45
  degreeToRadians(): DPolygonLoop;
40
46
  radiansToDegrees(): DPolygonLoop;
41
47
  radiansToMeters(): DPolygonLoop;
@@ -36,6 +36,8 @@ var LoopFunctions;
36
36
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
37
37
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
38
38
  LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
39
+ LoopFunctions[LoopFunctions["div"] = 33] = "div";
40
+ LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
39
41
  })(LoopFunctions || (LoopFunctions = {}));
40
42
  var decodePoolRecord = function (a, _a) {
41
43
  var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg, setterArgByObject = _a.setterArgByObject;
@@ -113,6 +115,14 @@ var decodePoolRecord = function (a, _a) {
113
115
  res = function (k, index) { return a(k, index)
114
116
  .divide(numberPointArg, numberArg); };
115
117
  break;
118
+ case LoopFunctions.div:
119
+ res = function (k, index) { return a(k, index)
120
+ .div(numberPointArg, numberArg); };
121
+ break;
122
+ case LoopFunctions.mod:
123
+ res = function (k, index) { return a(k, index)
124
+ .mod(numberPointArg, numberArg); };
125
+ break;
116
126
  case LoopFunctions.degreeToRadians:
117
127
  res = function (k, index) { return a(k, index)
118
128
  .degreeToRadians(); };
@@ -322,6 +332,22 @@ var DPolygonLoop = (function () {
322
332
  });
323
333
  return this;
324
334
  };
335
+ DPolygonLoop.prototype.div = function (x, y) {
336
+ this.pool.push({
337
+ functionName: LoopFunctions.div,
338
+ numberPointArg: x,
339
+ numberArg: y
340
+ });
341
+ return this;
342
+ };
343
+ DPolygonLoop.prototype.mod = function (x, y) {
344
+ this.pool.push({
345
+ functionName: LoopFunctions.mod,
346
+ numberPointArg: x,
347
+ numberArg: y
348
+ });
349
+ return this;
350
+ };
325
351
  DPolygonLoop.prototype.degreeToRadians = function () {
326
352
  this.pool.push({
327
353
  functionName: LoopFunctions.degreeToRadians
@@ -39,4 +39,5 @@ export declare const cartesianProduct: {
39
39
  <T>(a: T[], ...b: T[][]): T[][];
40
40
  };
41
41
  export declare const getCombinations: <T>(arr: T[][]) => T[][];
42
+ export declare const div: (a: number, b: number) => number;
42
43
  export {};
package/dist/cjs/utils.js CHANGED
@@ -25,7 +25,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
25
25
  return to.concat(ar || Array.prototype.slice.call(from));
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.getCombinations = exports.cartesianProduct = exports.createCanvas = exports.gaussianElimination = exports.createMatrix = exports.createArray = exports.checkFunction = exports.isDefAndNotNull = exports.warn = exports.DGeo = void 0;
28
+ exports.div = exports.getCombinations = exports.cartesianProduct = exports.createCanvas = exports.gaussianElimination = exports.createMatrix = exports.createArray = exports.checkFunction = exports.isDefAndNotNull = exports.warn = exports.DGeo = void 0;
29
29
  var DPoint_1 = require("./DPoint");
30
30
  exports.DGeo = {
31
31
  DEBUG: false
@@ -214,3 +214,5 @@ var getCombinations = function (arr) {
214
214
  return ans;
215
215
  };
216
216
  exports.getCombinations = getCombinations;
217
+ var div = function (a, b) { return Math.floor(a / b); };
218
+ exports.div = div;
@@ -1,15 +1,15 @@
1
1
  import { DLine } from './DLine';
2
2
  import { DPolygon } from './DPolygon';
3
- import { checkFunction, createArray, isDefAndNotNull } from './utils';
3
+ import { checkFunction, createArray, div, isDefAndNotNull } from './utils';
4
4
  const diff = 0;
5
5
  const radiansPolygon = new DPolygon();
6
6
  const pseudoMercatorPolygon = new DPolygon();
7
7
  const worldGeodeticPolygon = new DPolygon();
8
- export const EARTH_RADIUS_IN_METERS = 6371008.8;
9
- const EARTH_IN_MITERS = 20037508.34;
8
+ export const EARTH_RADIUS_IN_METERS = 6378137;
9
+ const EARTH_IN_METERS = 20037508.34;
10
10
  const DEGREES_IN_EARTH = 180;
11
- const MITERS_IN_ONE_DEGREE = EARTH_IN_MITERS / DEGREES_IN_EARTH;
12
- const DEGREES_IN_ONE_MITER = DEGREES_IN_EARTH / EARTH_IN_MITERS;
11
+ const METERS_IN_ONE_DEGREE = EARTH_IN_METERS / DEGREES_IN_EARTH;
12
+ const DEGREES_IN_ONE_METER = DEGREES_IN_EARTH / EARTH_IN_METERS;
13
13
  export const HALF_PI_IN_DEGREE = 90;
14
14
  export const PI_IN_DEGREE = 180;
15
15
  export const DOUBLE_PI_IN_DEGREE = 360;
@@ -295,9 +295,9 @@ export class DPoint {
295
295
  checkFunction('degreeToMeters')
296
296
  .checkArgument('this')
297
297
  .shouldBeDegree(this);
298
- const x = ((this.x + PI_IN_DEGREE) % DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE) * MITERS_IN_ONE_DEGREE;
298
+ const x = ((this.x + PI_IN_DEGREE) % DOUBLE_PI_IN_DEGREE - PI_IN_DEGREE) * METERS_IN_ONE_DEGREE;
299
299
  const y = (Math.log(Math.tan(((this.y + HALF_PI_IN_DEGREE) % PI_IN_DEGREE) *
300
- (Math.PI / DOUBLE_PI_IN_DEGREE))) / PI_TO_DEGREE) * MITERS_IN_ONE_DEGREE;
300
+ (Math.PI / DOUBLE_PI_IN_DEGREE))) / PI_TO_DEGREE) * METERS_IN_ONE_DEGREE;
301
301
  this.x = x;
302
302
  this.y = y;
303
303
  return this;
@@ -306,8 +306,8 @@ export class DPoint {
306
306
  checkFunction('metersToDegree')
307
307
  .checkArgument('this')
308
308
  .shouldBeMeters(this);
309
- const lon = this.x * DEGREES_IN_ONE_MITER;
310
- const lat = Math.atan(Math.pow(Math.E, ((this.y / MITERS_IN_ONE_DEGREE) * PI_TO_DEGREE))) *
309
+ const lon = this.x * DEGREES_IN_ONE_METER;
310
+ const lat = Math.atan(Math.pow(Math.E, ((this.y / METERS_IN_ONE_DEGREE) * PI_TO_DEGREE))) *
311
311
  (DOUBLE_PI_IN_DEGREE / Math.PI) - HALF_PI_IN_DEGREE;
312
312
  this.x = lon;
313
313
  this.y = lat;
@@ -412,6 +412,56 @@ export class DPoint {
412
412
  }
413
413
  return this;
414
414
  }
415
+ mod(x, y = x, z) {
416
+ let xV = 0;
417
+ let yV = 0;
418
+ let zV = undefined;
419
+ if (x instanceof DPoint) {
420
+ xV = this.x % x.x;
421
+ yV = this.y % x.y;
422
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
423
+ zV = this.z % x.z;
424
+ }
425
+ }
426
+ else {
427
+ xV = this.x % x;
428
+ yV = this.y % y;
429
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
430
+ zV = this.z % z;
431
+ }
432
+ }
433
+ this.x = xV;
434
+ this.y = yV;
435
+ if (isDefAndNotNull(zV)) {
436
+ this.z = zV;
437
+ }
438
+ return this;
439
+ }
440
+ div(x, y = x, z) {
441
+ let xV = 0;
442
+ let yV = 0;
443
+ let zV = undefined;
444
+ if (x instanceof DPoint) {
445
+ xV = div(this.x, x.x);
446
+ yV = div(this.y, x.y);
447
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(x.z)) {
448
+ zV = div(this.z, x.z);
449
+ }
450
+ }
451
+ else {
452
+ xV = div(this.x, x);
453
+ yV = div(this.y, y);
454
+ if (isDefAndNotNull(this.z) && isDefAndNotNull(z)) {
455
+ zV = div(this.z, z);
456
+ }
457
+ }
458
+ this.x = xV;
459
+ this.y = yV;
460
+ if (isDefAndNotNull(zV)) {
461
+ this.z = zV;
462
+ }
463
+ return this;
464
+ }
415
465
  equal(p) {
416
466
  return this.x === p.x && this.y === p.y && this.z === p.z;
417
467
  }
@@ -33,6 +33,8 @@ var LoopFunctions;
33
33
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
34
34
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
35
35
  LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
36
+ LoopFunctions[LoopFunctions["div"] = 33] = "div";
37
+ LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
36
38
  })(LoopFunctions || (LoopFunctions = {}));
37
39
  const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg, setterArgByObject }) => {
38
40
  let res = a;
@@ -109,6 +111,14 @@ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg
109
111
  res = (k, index) => a(k, index)
110
112
  .divide(numberPointArg, numberArg);
111
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;
112
122
  case LoopFunctions.degreeToRadians:
113
123
  res = (k, index) => a(k, index)
114
124
  .degreeToRadians();
@@ -315,6 +325,22 @@ export class DPolygonLoop {
315
325
  });
316
326
  return this;
317
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
+ }
318
344
  degreeToRadians() {
319
345
  this.pool.push({
320
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;
@@ -332,9 +332,9 @@ var DPoint = (function () {
332
332
  checkFunction('degreeToMeters')
333
333
  .checkArgument('this')
334
334
  .shouldBeDegree(this);
335
- 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;
336
336
  var y = (Math.log(Math.tan(((this.y + HALF_PI_IN_DEGREE) % PI_IN_DEGREE) *
337
- (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;
338
338
  this.x = x;
339
339
  this.y = y;
340
340
  return this;
@@ -343,8 +343,8 @@ var DPoint = (function () {
343
343
  checkFunction('metersToDegree')
344
344
  .checkArgument('this')
345
345
  .shouldBeMeters(this);
346
- var lon = this.x * DEGREES_IN_ONE_MITER;
347
- 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))) *
348
348
  (DOUBLE_PI_IN_DEGREE / Math.PI) - HALF_PI_IN_DEGREE;
349
349
  this.x = lon;
350
350
  this.y = lat;
@@ -452,6 +452,58 @@ var DPoint = (function () {
452
452
  }
453
453
  return this;
454
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
+ };
455
507
  DPoint.prototype.equal = function (p) {
456
508
  return this.x === p.x && this.y === p.y && this.z === p.z;
457
509
  };
@@ -33,6 +33,8 @@ var LoopFunctions;
33
33
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
34
34
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
35
35
  LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
36
+ LoopFunctions[LoopFunctions["div"] = 33] = "div";
37
+ LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
36
38
  })(LoopFunctions || (LoopFunctions = {}));
37
39
  var decodePoolRecord = function (a, _a) {
38
40
  var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg, setterArgByObject = _a.setterArgByObject;
@@ -110,6 +112,14 @@ var decodePoolRecord = function (a, _a) {
110
112
  res = function (k, index) { return a(k, index)
111
113
  .divide(numberPointArg, numberArg); };
112
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;
113
123
  case LoopFunctions.degreeToRadians:
114
124
  res = function (k, index) { return a(k, index)
115
125
  .degreeToRadians(); };
@@ -319,6 +329,22 @@ var DPolygonLoop = (function () {
319
329
  });
320
330
  return this;
321
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
+ };
322
348
  DPolygonLoop.prototype.degreeToRadians = function () {
323
349
  this.pool.push({
324
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); };