dgeoutils 2.3.7 → 2.4.0

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.
@@ -97,7 +97,7 @@ export declare class DPolygon {
97
97
  static parse(a: number[][]): DPolygon;
98
98
  static parse(a: DCoord[]): DPolygon;
99
99
  toArrayOfCoords(): DCoord[];
100
- divideToPieces(piecesCount: number): DPolygon;
100
+ divideToPieces(piecesCount: number, withAltitude?: boolean): DPolygon;
101
101
  prepareToFastSearch(): void;
102
102
  fastHas({ x, y, z }: DPoint): boolean;
103
103
  get growingPiecesGenerator(): () => Generator<DPolygon, DPolygon>;
@@ -961,8 +961,9 @@ var DPolygon = (function () {
961
961
  DPolygon.prototype.toArrayOfCoords = function () {
962
962
  return this.mapArray(function (r) { return r.toCoords(); });
963
963
  };
964
- DPolygon.prototype.divideToPieces = function (piecesCount) {
964
+ DPolygon.prototype.divideToPieces = function (piecesCount, withAltitude) {
965
965
  var e_13, _a;
966
+ if (withAltitude === void 0) { withAltitude = false; }
966
967
  var fullLength = this.fullLength;
967
968
  var pieceLength = fullLength / piecesCount;
968
969
  var currentPieceLength = pieceLength;
@@ -979,6 +980,10 @@ var DPolygon = (function () {
979
980
  .filter(function (p) { return line_1.inRange(p, CLOSE_TO_INTERSECTION_DISTANCE); })[0];
980
981
  intersectionPoint.properties.pieceBorder = true;
981
982
  this_1.insertAfter(i, intersectionPoint);
983
+ if (withAltitude) {
984
+ var p1z = p1.z;
985
+ intersectionPoint.z = p1z - (p1z - p2.z) * (p1.distance(intersectionPoint) / d);
986
+ }
982
987
  currentPieceLength = pieceLength;
983
988
  }
984
989
  else {
@@ -624,7 +624,7 @@ export class DPolygon {
624
624
  toArrayOfCoords() {
625
625
  return this.mapArray((r) => r.toCoords());
626
626
  }
627
- divideToPieces(piecesCount) {
627
+ divideToPieces(piecesCount, withAltitude = false) {
628
628
  const { fullLength } = this;
629
629
  const pieceLength = fullLength / piecesCount;
630
630
  let currentPieceLength = pieceLength;
@@ -641,6 +641,10 @@ export class DPolygon {
641
641
  .filter((p) => line.inRange(p, CLOSE_TO_INTERSECTION_DISTANCE))[0];
642
642
  intersectionPoint.properties.pieceBorder = true;
643
643
  this.insertAfter(i, intersectionPoint);
644
+ if (withAltitude) {
645
+ const p1z = p1.z;
646
+ intersectionPoint.z = p1z - (p1z - p2.z) * (p1.distance(intersectionPoint) / d);
647
+ }
644
648
  currentPieceLength = pieceLength;
645
649
  }
646
650
  else {
@@ -958,8 +958,9 @@ var DPolygon = (function () {
958
958
  DPolygon.prototype.toArrayOfCoords = function () {
959
959
  return this.mapArray(function (r) { return r.toCoords(); });
960
960
  };
961
- DPolygon.prototype.divideToPieces = function (piecesCount) {
961
+ DPolygon.prototype.divideToPieces = function (piecesCount, withAltitude) {
962
962
  var e_13, _a;
963
+ if (withAltitude === void 0) { withAltitude = false; }
963
964
  var fullLength = this.fullLength;
964
965
  var pieceLength = fullLength / piecesCount;
965
966
  var currentPieceLength = pieceLength;
@@ -976,6 +977,10 @@ var DPolygon = (function () {
976
977
  .filter(function (p) { return line_1.inRange(p, CLOSE_TO_INTERSECTION_DISTANCE); })[0];
977
978
  intersectionPoint.properties.pieceBorder = true;
978
979
  this_1.insertAfter(i, intersectionPoint);
980
+ if (withAltitude) {
981
+ var p1z = p1.z;
982
+ intersectionPoint.z = p1z - (p1z - p2.z) * (p1.distance(intersectionPoint) / d);
983
+ }
979
984
  currentPieceLength = pieceLength;
980
985
  }
981
986
  else {