@flatten-js/core
Advanced tools
Comparing version 1.2.20 to 1.2.21
@@ -384,3 +384,3 @@ // Type definitions for flatten-js library | ||
class PlanarSet extends Set { | ||
constructor(); | ||
constructor(shapes?: IndexableElement[] | Set<IndexableElement>); | ||
@@ -387,0 +387,0 @@ // members |
{ | ||
"name": "@flatten-js/core", | ||
"version": "1.2.20", | ||
"version": "1.2.21", | ||
"description": "Javascript library for 2d geometry", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.cjs.js", |
[![npm version](https://badge.fury.io/js/%40flatten-js%2Fcore.svg)](https://badge.fury.io/js/%40flatten-js%2Fcore) | ||
[![Build Status](https://travis-ci.org/alexbol99/flatten-js.svg?branch=master)](https://travis-ci.org/alexbol99/flatten-js) | ||
[![Coverage Status](https://coveralls.io/repos/github/alexbol99/flatten-js/badge.svg?branch=master)](https://coveralls.io/github/alexbol99/flatten-js?branch=master) | ||
[![](https://data.jsdelivr.com/v1/package/npm/@flatten-js/core/badge)](https://www.jsdelivr.com/package/npm/@flatten-js/core) | ||
# Javascript library for 2d geometry | ||
@@ -7,0 +7,0 @@ |
@@ -815,3 +815,3 @@ /** | ||
for (let k = int_points_from_pull_start; k < int_points_from_pull_start + int_points_from_pull_num; k++) { | ||
int_point_current.edge_after = undefined; | ||
int_points[k].edge_after = undefined; | ||
} | ||
@@ -821,3 +821,3 @@ | ||
for (let k = int_points_to_pull_start; k < int_points_to_pull_start + int_points_to_pull_num; k++) { | ||
int_point_next.edge_before = undefined; | ||
int_points[k].edge_before = undefined; | ||
} | ||
@@ -824,0 +824,0 @@ } |
@@ -491,3 +491,3 @@ /** | ||
return ip; | ||
return line.sortPoints(ip); | ||
} | ||
@@ -494,0 +494,0 @@ |
@@ -237,3 +237,5 @@ /** | ||
/** | ||
* Cut polygon with line and return array of new polygons | ||
* Cut polygon with multiline and return array of new polygons | ||
* Multiline should be constructed from a line with intersection point, see notebook: | ||
* https://next.observablehq.com/@alexbol99/cut-polygon-with-line | ||
* @param {Multiline} multiline | ||
@@ -240,0 +242,0 @@ * @returns {Polygon[]} |
@@ -17,7 +17,10 @@ /** | ||
/** | ||
* Create new empty instance of PlanarSet | ||
* Create new instance of PlanarSet | ||
* @param shapes - array or set of geometric objects to store in planar set | ||
* Each object should have a <b>box</b> property | ||
*/ | ||
constructor() { | ||
super(); | ||
constructor(shapes) { | ||
super(shapes); | ||
this.index = new IntervalTree(); | ||
this.forEach(shape => this.index.insert(shape)) | ||
} | ||
@@ -24,0 +27,0 @@ |
@@ -263,4 +263,38 @@ 'use strict'; | ||
expect(de9im.intersect()).to.be.true; | ||
}) | ||
}); | ||
it('Infinite loop when subtracting polygons (v1.2.20) Issue #81', function() { | ||
const pA = new Flatten.Polygon([ | ||
[50, 100], | ||
[100, 100], | ||
[100, 50], | ||
[100, 0], | ||
[50, 0], | ||
[0, 0], | ||
[0, 50], | ||
[50, 50], | ||
[50, 100] | ||
]); | ||
const pB = new Flatten.Polygon([ | ||
[50, 50], | ||
[100, 50], | ||
[100, 0], | ||
[50, 0], | ||
[50, 50] | ||
]); | ||
const pC = new Flatten.Polygon([ | ||
[50, 50], | ||
[50, 100], | ||
[100, 100], | ||
[100, 50], | ||
[50, 50] | ||
]); | ||
const p0 = Flatten.BooleanOperations.subtract(pA, pB); | ||
expect(p0.faces.size).to.equal(1); | ||
expect(p0.edges.size).to.equal(8); | ||
expect(p0.contains(pB)).to.be.false; | ||
expect(p0.contains(pC)).to.be.true; | ||
}); | ||
}); | ||
}); |
@@ -828,4 +828,4 @@ /** | ||
expect(cut_polygons.length).to.equal(2); | ||
expect(cut_polygons[0].edges.size).to.equal(6); | ||
expect(cut_polygons[1].edges.size).to.equal(5); | ||
expect(cut_polygons[0].edges.size).to.equal(5); | ||
expect(cut_polygons[1].edges.size).to.equal(6); | ||
}); | ||
@@ -842,5 +842,5 @@ it('Can cut polygon with line into 3 polygons', function() { | ||
expect(cut_polygons.length).to.equal(3); | ||
expect(cut_polygons[0].edges.size).to.equal(9); | ||
expect(cut_polygons[0].edges.size).to.equal(3); | ||
expect(cut_polygons[1].edges.size).to.equal(3); | ||
expect(cut_polygons[2].edges.size).to.equal(3); | ||
expect(cut_polygons[2].edges.size).to.equal(9); | ||
}); | ||
@@ -847,0 +847,0 @@ |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
5427897
34770