Comparing version 2.4.52 to 2.5.0
@@ -54,2 +54,3 @@ import { DLine } from './DLine'; | ||
distance(p: DPoint): number; | ||
distanceLatLon(p: DPoint): number; | ||
distance3d(p: DPoint): number; | ||
@@ -56,0 +57,0 @@ setX(x: number): DPoint; |
@@ -269,2 +269,19 @@ "use strict"; | ||
}; | ||
DPoint.prototype.distanceLatLon = function (p) { | ||
(0, utils_1.checkFunction)('distance') | ||
.checkArgument('this') | ||
.shouldBeDegree(this) | ||
.checkArgument('p') | ||
.shouldBeDegree(p); | ||
var d = p.clone().move(this.clone().minus()) | ||
.degreeToRadians(); | ||
var t1 = this.clone().degreeToRadians(); | ||
var t2 = p.clone().degreeToRadians(); | ||
var a = Math.pow(Math.sin(d.lat / 2), 2) + | ||
Math.cos(t1.lat) * | ||
Math.cos(t2.lat) * | ||
(Math.pow((Math.sin(d.lon / 2)), 2)); | ||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
return exports.EARTH_RADIUS_IN_METERS * c; | ||
}; | ||
DPoint.prototype.distance3d = function (p) { | ||
@@ -271,0 +288,0 @@ (0, utils_1.checkFunction)('distance3d') |
@@ -47,3 +47,5 @@ /// <reference types="offscreencanvas" /> | ||
get fullLength(): number; | ||
get fullLengthLatLon(): number; | ||
get perimeter(): number; | ||
get perimeterLatLon(): number; | ||
get area(): number; | ||
@@ -50,0 +52,0 @@ get filledDeintersection(): DPolygon; |
@@ -229,2 +229,19 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
} | ||
distanceLatLon(p) { | ||
checkFunction('distance') | ||
.checkArgument('this') | ||
.shouldBeDegree(this) | ||
.checkArgument('p') | ||
.shouldBeDegree(p); | ||
const d = p.clone().move(this.clone().minus()) | ||
.degreeToRadians(); | ||
const t1 = this.clone().degreeToRadians(); | ||
const t2 = p.clone().degreeToRadians(); | ||
const a = Math.pow(Math.sin(d.lat / 2), 2) + | ||
Math.cos(t1.lat) * | ||
Math.cos(t2.lat) * | ||
(Math.pow((Math.sin(d.lon / 2)), 2)); | ||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
return EARTH_RADIUS_IN_METERS * c; | ||
} | ||
distance3d(p) { | ||
@@ -231,0 +248,0 @@ checkFunction('distance3d') |
@@ -212,2 +212,5 @@ import { DPoint } from './DPoint'; | ||
} | ||
get fullLengthLatLon() { | ||
return this.clone().open().perimeterLatLon; | ||
} | ||
get perimeter() { | ||
@@ -220,2 +223,9 @@ let p = 0; | ||
} | ||
get perimeterLatLon() { | ||
let p = 0; | ||
for (const [p1, p2] of this.loopPointsGenerator()()) { | ||
p += p1.distanceLatLon(p2); | ||
} | ||
return p; | ||
} | ||
get area() { | ||
@@ -222,0 +232,0 @@ let sum = 0; |
@@ -266,2 +266,19 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
DPoint.prototype.distanceLatLon = function (p) { | ||
checkFunction('distance') | ||
.checkArgument('this') | ||
.shouldBeDegree(this) | ||
.checkArgument('p') | ||
.shouldBeDegree(p); | ||
var d = p.clone().move(this.clone().minus()) | ||
.degreeToRadians(); | ||
var t1 = this.clone().degreeToRadians(); | ||
var t2 = p.clone().degreeToRadians(); | ||
var a = Math.pow(Math.sin(d.lat / 2), 2) + | ||
Math.cos(t1.lat) * | ||
Math.cos(t2.lat) * | ||
(Math.pow((Math.sin(d.lon / 2)), 2)); | ||
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
return EARTH_RADIUS_IN_METERS * c; | ||
}; | ||
DPoint.prototype.distance3d = function (p) { | ||
@@ -268,0 +285,0 @@ checkFunction('distance3d') |
{ | ||
"name": "dgeoutils", | ||
"version": "2.4.52", | ||
"version": "2.5.0", | ||
"description": "Geometries utils for my projects", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1380181
19236
0