Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dgeoutils

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dgeoutils - npm Package Compare versions

Comparing version 2.4.52 to 2.5.0

1

dist/cjs/DPoint.d.ts

@@ -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')

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc