dgeoutils 2.4.11 → 2.4.12
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/cjs/DPoint.d.ts +1 -0
- package/dist/cjs/DPoint.js +21 -0
- package/dist/es2015/DPoint.js +21 -0
- package/dist/esm/DPoint.js +21 -0
- package/dist/umd/dgeoutils.js +22 -1
- package/dist/umd/dgeoutils.min.js +1 -1
- package/dist/umd/dgeoutils.min.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/DPoint.d.ts
CHANGED
|
@@ -118,5 +118,6 @@ export declare class DPoint {
|
|
|
118
118
|
minus(): DPoint;
|
|
119
119
|
orthodromicPath(point: DPoint, pointsCount?: number): DPolygon;
|
|
120
120
|
sortByDistance(p: DPolygon): DPolygon;
|
|
121
|
+
calculateAltitudeByDistanceBetweenPoints(p1: DPoint, p2: DPoint): DPoint;
|
|
121
122
|
}
|
|
122
123
|
export {};
|
package/dist/cjs/DPoint.js
CHANGED
|
@@ -686,6 +686,27 @@ var DPoint = (function () {
|
|
|
686
686
|
})
|
|
687
687
|
.sort(function (a, b) { return a.properties.distance - b.properties.distance; });
|
|
688
688
|
};
|
|
689
|
+
DPoint.prototype.calculateAltitudeByDistanceBetweenPoints = function (p1, p2) {
|
|
690
|
+
var _a, _b, _c, _d;
|
|
691
|
+
if (p1.alt === p2.alt) {
|
|
692
|
+
this.alt = p1.alt;
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
var minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
|
|
696
|
+
var maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
|
|
697
|
+
var dAlt = maxAlt - minAlt;
|
|
698
|
+
var distance1 = this.distance(p1);
|
|
699
|
+
var distance2 = this.distance(p2);
|
|
700
|
+
var totalDistance = distance1 + distance2;
|
|
701
|
+
if (p1.alt === minAlt) {
|
|
702
|
+
this.alt = minAlt + distance1 / totalDistance * dAlt;
|
|
703
|
+
}
|
|
704
|
+
else {
|
|
705
|
+
this.alt = minAlt + distance2 / totalDistance * dAlt;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return this;
|
|
709
|
+
};
|
|
689
710
|
return DPoint;
|
|
690
711
|
}());
|
|
691
712
|
exports.DPoint = DPoint;
|
package/dist/es2015/DPoint.js
CHANGED
|
@@ -565,4 +565,25 @@ export class DPoint {
|
|
|
565
565
|
})
|
|
566
566
|
.sort((a, b) => a.properties.distance - b.properties.distance);
|
|
567
567
|
}
|
|
568
|
+
calculateAltitudeByDistanceBetweenPoints(p1, p2) {
|
|
569
|
+
var _a, _b, _c, _d;
|
|
570
|
+
if (p1.alt === p2.alt) {
|
|
571
|
+
this.alt = p1.alt;
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
const minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
|
|
575
|
+
const maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
|
|
576
|
+
const dAlt = maxAlt - minAlt;
|
|
577
|
+
const distance1 = this.distance(p1);
|
|
578
|
+
const distance2 = this.distance(p2);
|
|
579
|
+
const totalDistance = distance1 + distance2;
|
|
580
|
+
if (p1.alt === minAlt) {
|
|
581
|
+
this.alt = minAlt + distance1 / totalDistance * dAlt;
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
this.alt = minAlt + distance2 / totalDistance * dAlt;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return this;
|
|
588
|
+
}
|
|
568
589
|
}
|
package/dist/esm/DPoint.js
CHANGED
|
@@ -683,6 +683,27 @@ var DPoint = (function () {
|
|
|
683
683
|
})
|
|
684
684
|
.sort(function (a, b) { return a.properties.distance - b.properties.distance; });
|
|
685
685
|
};
|
|
686
|
+
DPoint.prototype.calculateAltitudeByDistanceBetweenPoints = function (p1, p2) {
|
|
687
|
+
var _a, _b, _c, _d;
|
|
688
|
+
if (p1.alt === p2.alt) {
|
|
689
|
+
this.alt = p1.alt;
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
var minAlt = Math.min((_a = p1.alt) !== null && _a !== void 0 ? _a : 0, (_b = p2.alt) !== null && _b !== void 0 ? _b : 0);
|
|
693
|
+
var maxAlt = Math.max((_c = p1.alt) !== null && _c !== void 0 ? _c : 0, (_d = p2.alt) !== null && _d !== void 0 ? _d : 0);
|
|
694
|
+
var dAlt = maxAlt - minAlt;
|
|
695
|
+
var distance1 = this.distance(p1);
|
|
696
|
+
var distance2 = this.distance(p2);
|
|
697
|
+
var totalDistance = distance1 + distance2;
|
|
698
|
+
if (p1.alt === minAlt) {
|
|
699
|
+
this.alt = minAlt + distance1 / totalDistance * dAlt;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
this.alt = minAlt + distance2 / totalDistance * dAlt;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return this;
|
|
706
|
+
};
|
|
686
707
|
return DPoint;
|
|
687
708
|
}());
|
|
688
709
|
export { DPoint };
|