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.2.8 to 2.2.9

3

dist/DPolygon.d.ts

@@ -84,3 +84,3 @@ /// <reference types="offscreencanvas" />

clearPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
contain(p: DPoint, isBorderInside?: boolean, move?: DPoint): boolean;
contain(p: DPoint, isBorderInside?: boolean): boolean;
onBorder(p: DPoint): boolean;

@@ -109,5 +109,4 @@ nextStart(): DPolygon;

private goByPath;
private contain2;
private getJSTSGeometry;
private simpleLogicFunction;
}

@@ -495,3 +495,3 @@ "use strict";

}
contain(p, isBorderInside = false, move = DPoint_1.DPoint.zero()) {
contain(p, isBorderInside = false) {
const simpleInclude = this.simpleInclude(p);

@@ -505,17 +505,30 @@ if (!simpleInclude) {

}
const line = p.findLine(this.leftTop.move(move));
const poly = this.deintersection;
const intersectionPoints = [];
let totalFi = 0;
for (let i = 0; i < poly.length - 1; i++) {
const polygonLine = poly.at(i).findLine(poly.at(i + 1));
const intersection = line.intersection(polygonLine, CLOSE_TO_INTERSECTION_DISTANCE);
if (intersection) {
intersectionPoints.push(intersection);
const p1 = poly.at(i);
const p2 = poly.at(i + 1);
const line1 = new DLine_1.DLine(p1.x - p.x, p1.y - p.y, 0);
const line2 = new DLine_1.DLine(p2.x - p.x, p2.y - p.y, 0);
const fiDif = line1.findFi(line2);
if (line1.vectorProduct(line2).c > 0) {
totalFi += fiDif;
}
else {
totalFi -= fiDif;
}
}
const hasCorners = intersectionPoints.some((z) => poly.has(z));
if (hasCorners) {
return this.contain2(p, isBorderInside);
const eps = Math.PI / 10000;
let result = false;
const absTotalFi = Math.abs(totalFi);
if (absTotalFi < eps) {
result = false;
}
return intersectionPoints.length % 2 === 1;
else if (Math.abs(2 * Math.PI - absTotalFi) < eps) {
result = true;
}
else {
throw new Error('contains2 faild');
}
return result;
}

@@ -835,40 +848,2 @@ onBorder(p) {

}
contain2(p, isBorderInside = false) {
const simpleInclude = this.simpleInclude(p);
if (!simpleInclude) {
return false;
}
const onBorder = this.onBorder(p);
if (onBorder) {
return isBorderInside;
}
const poly = this.deintersection;
let totalFi = 0;
for (let i = 0; i < poly.length - 1; i++) {
const p1 = poly.at(i);
const p2 = poly.at(i + 1);
const line1 = new DLine_1.DLine(p1.x - p.x, p1.y - p.y, 0);
const line2 = new DLine_1.DLine(p2.x - p.x, p2.y - p.y, 0);
const fiDif = line1.findFi(line2);
if (line1.vectorProduct(line2).c > 0) {
totalFi += fiDif;
}
else {
totalFi -= fiDif;
}
}
const eps = Math.PI / 10000;
let result = false;
const absTotalFi = Math.abs(totalFi);
if (absTotalFi < eps) {
result = false;
}
else if (Math.abs(2 * Math.PI - absTotalFi) < eps) {
result = true;
}
else {
throw new Error('contains2 faild');
}
return result;
}
getJSTSGeometry(p, unionThis, unionThat) {

@@ -875,0 +850,0 @@ const unionOrIntersection = unionThat === unionThis;

{
"name": "dgeoutils",
"version": "2.2.8",
"version": "2.2.9",
"description": "",

@@ -5,0 +5,0 @@ "scripts": {

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