Socket
Socket
Sign inDemoInstall

@here/harp-geometry

Package Overview
Dependencies
3
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.21.0 to 0.22.0

lib/ClipLineString.d.ts

4

index.js
"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -15,3 +15,3 @@ * SPDX-License-Identifier: Apache-2.0

var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};

@@ -18,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

import { Vector2 } from "three";
interface ClipInfo {
/**
* `true` if this vertex was clipped.
*/
isClipped?: boolean;
}
export declare type ClippedVertex = Vector2 & ClipInfo;
/**

@@ -30,3 +37,3 @@ * Abstract helper class used to implement the Sutherland-Hodgman clipping algorithm.

*/
abstract computeIntersection(a: Vector2, b: Vector2, extent: number): Vector2;
abstract computeIntersection(a: Vector2, b: Vector2, extent: number): ClippedVertex;
/**

@@ -50,2 +57,3 @@ * Clip the polygon against this clipping edge.

export declare function clipPolygon(polygon: Vector2[], extent: number): Vector2[];
export {};
//# sourceMappingURL=ClipPolygon.d.ts.map
"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2020-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -30,3 +30,6 @@ * SPDX-License-Identifier: Apache-2.0

const pushPoint = (point) => {
if (polygon.length === 0 || !polygon[polygon.length - 1].equals(point)) {
const lastAddedPoint = polygon[polygon.length - 1];
if (!(lastAddedPoint === null || lastAddedPoint === void 0 ? void 0 : lastAddedPoint.equals(point)) ||
(point.isClipped === true && !(lastAddedPoint === null || lastAddedPoint === void 0 ? void 0 : lastAddedPoint.isClipped)) ||
(!point.isClipped && (lastAddedPoint === null || lastAddedPoint === void 0 ? void 0 : lastAddedPoint.isClipped) === true)) {
polygon.push(point);

@@ -40,3 +43,5 @@ }

if (!this.inside(prevPoint, extent)) {
pushPoint(this.computeIntersection(prevPoint, currentPoint, extent));
const p = this.computeIntersection(prevPoint, currentPoint, extent);
p.isClipped = true;
pushPoint(p);
}

@@ -46,3 +51,5 @@ pushPoint(currentPoint);

else if (this.inside(prevPoint, extent)) {
pushPoint(this.computeIntersection(prevPoint, currentPoint, extent));
const p = this.computeIntersection(prevPoint, currentPoint, extent);
p.isClipped = true;
pushPoint(p);
}

@@ -57,3 +64,3 @@ }

inside(point) {
return point.y > 0;
return point.y >= 0;
}

@@ -73,3 +80,4 @@ /**

const { x: x2, y: y2 } = b;
return new three_1.Vector2((x1 * y2 - y1 * x2) / -(y1 - y2), 0).round();
const v = new three_1.Vector2((x1 * y2 - y1 * x2) / -(y1 - y2), 0).round();
return v;
}

@@ -80,3 +88,3 @@ }

inside(point, extent) {
return point.x < extent;
return point.x <= extent;
}

@@ -96,3 +104,4 @@ /**

const { x: x2, y: y2 } = b;
return new three_1.Vector2(extent, (x1 * y2 - y1 * x2 - (y1 - y2) * -extent) / (x1 - x2)).round();
const v = new three_1.Vector2(extent, (x1 * y2 - y1 * x2 - (y1 - y2) * -extent) / (x1 - x2)).round();
return v;
}

@@ -103,3 +112,3 @@ }

inside(point, extent) {
return point.y < extent;
return point.y <= extent;
}

@@ -119,3 +128,4 @@ /**

const { x: x2, y: y2 } = b;
return new three_1.Vector2((x1 * y2 - y1 * x2 - (x1 - x2) * extent) / -(y1 - y2), extent).round();
const v = new three_1.Vector2((x1 * y2 - y1 * x2 - (x1 - x2) * extent) / -(y1 - y2), extent).round();
return v;
}

@@ -126,3 +136,3 @@ }

inside(point) {
return point.x > 0;
return point.x >= 0;
}

@@ -142,3 +152,4 @@ /**

const { x: x2, y: y2 } = b;
return new three_1.Vector2(0, (x1 * y2 - y1 * x2) / (x1 - x2)).round();
const v = new three_1.Vector2(0, (x1 * y2 - y1 * x2) / (x1 - x2)).round();
return v;
}

@@ -172,2 +183,5 @@ }

}
if (polygon.length < 3) {
return [];
}
return polygon;

@@ -174,0 +188,0 @@ }

"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2020-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -5,0 +5,0 @@ * SPDX-License-Identifier: Apache-2.0

"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -8,2 +8,3 @@ * SPDX-License-Identifier: Apache-2.0

Object.defineProperty(exports, "__esModule", { value: true });
exports.OrientedBox3 = void 0;
/**

@@ -10,0 +11,0 @@ * Alias to [[OrientedBox3]] of [[@here/harp-geoutils]].

"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -5,0 +5,0 @@ * SPDX-License-Identifier: Apache-2.0

"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2019-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -137,3 +137,6 @@ * SPDX-License-Identifier: Apache-2.0

}
positionAttr.array = new Float32Array(position);
positionAttr.array =
positionAttr.array instanceof Float32Array
? new Float32Array(position)
: new Float64Array(position);
positionAttr.count = position.length / positionAttr.itemSize;

@@ -140,0 +143,0 @@ positionAttr.needsUpdate = true;

"use strict";
/*
* Copyright (C) 2017-2020 HERE Europe B.V.
* Copyright (C) 2020-2021 HERE Europe B.V.
* Licensed under Apache 2.0, see full license in LICENSE

@@ -5,0 +5,0 @@ * SPDX-License-Identifier: Apache-2.0

{
"name": "@here/harp-geometry",
"version": "0.21.0",
"version": "0.22.0",
"description": "Algorithms and data structures for processing geometries",

@@ -26,22 +26,22 @@ "main": "index.js",

"devDependencies": {
"@types/chai": "^4.2.11",
"@types/chai": "^4.2.14",
"@types/earcut": "^2.1.1",
"@types/mocha": "^7.0.2",
"@types/mocha": "^8.2.0",
"@types/node": "^14.0.5",
"@types/sinon": "^9.0.4",
"@types/sinon": "^9.0.10",
"chai": "^4.0.2",
"cross-env": "^7.0.2",
"earcut": "^2.2.2",
"mocha": "^7.2.0",
"sinon": "^9.0.2",
"mocha": "^8.2.1",
"sinon": "^9.2.2",
"source-map-support": "^0.5.19",
"three": "^0.120.1",
"typescript": "^3.9.3"
"three": "^0.124.0",
"typescript": "^4.1.2"
},
"peerDependencies": {
"three": "^0.120.1"
"three": "^0.124.0"
},
"dependencies": {
"@here/harp-geoutils": "^0.21.0",
"@here/harp-utils": "^0.21.0"
"@here/harp-geoutils": "^0.22.0",
"@here/harp-utils": "^0.22.0"
},

@@ -51,3 +51,3 @@ "publishConfig": {

},
"gitHead": "460af4b155d303d96cb69152cbdbc3ff4c72213e"
"gitHead": "a767dad893071489a0b97b2453f0050ea2772dd8"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc