Comparing version 3.3.3 to 3.5.2-alpha.d2c36ee7
45
index.js
@@ -77,22 +77,11 @@ //http://en.wikipedia.org/wiki/Delaunay_triangulation | ||
G = 2 * (A * (c.y - b.y) - B * (c.x - b.x)), | ||
minx, miny, dx, dy; | ||
dx, dy; | ||
// If the points of the triangle are collinear, then just find the | ||
// extremes and use the midpoint as the center of the circumcircle. | ||
if (Math.abs(G) < 0.000001) { | ||
minx = Math.min(a.x, b.x, c.x); | ||
miny = Math.min(a.y, b.y, c.y); | ||
dx = (Math.max(a.x, b.x, c.x) - minx) * 0.5; | ||
dy = (Math.max(a.y, b.y, c.y) - miny) * 0.5; | ||
this.x = minx + dx; | ||
this.y = miny + dy; | ||
this.r = dx * dx + dy * dy; | ||
} else { | ||
this.x = (D * E - B * F) / G; | ||
this.y = (A * F - C * E) / G; | ||
dx = this.x - a.x; | ||
dy = this.y - a.y; | ||
this.r = dx * dx + dy * dy; | ||
} | ||
this.x = (D * E - B * F) / G; | ||
this.y = (A * F - C * E) / G; | ||
dx = this.x - a.x; | ||
dy = this.y - a.y; | ||
this.r = dx * dx + dy * dy; | ||
} | ||
@@ -140,4 +129,12 @@ | ||
ymin = vertices[i].y, | ||
ymax = ymin; | ||
ymax = ymin, | ||
epsilon = 1e-12; | ||
var a, | ||
b, | ||
c, | ||
A, | ||
B, | ||
G; | ||
while (i--) { | ||
@@ -180,3 +177,3 @@ if (vertices[i].y < ymin) | ||
edges = [], | ||
j, a, b; | ||
j; | ||
@@ -224,3 +221,11 @@ // Incrementally add each vertex to the mesh. | ||
a = edges[--j]; | ||
open.push(new Triangle(a, b, vertices[i])); | ||
c = vertices[i]; | ||
// Avoid adding colinear triangles (which have error-prone | ||
// circumcircles) | ||
A = b.x - a.x; | ||
B = b.y - a.y; | ||
G = 2 * (A * (c.y - b.y) - B * (c.x - b.x)); | ||
if (Math.abs(G) > epsilon) { | ||
open.push(new Triangle(a, b, c)); | ||
} | ||
} | ||
@@ -227,0 +232,0 @@ } |
{ | ||
"name": "@turf/tin", | ||
"version": "3.3.3", | ||
"version": "3.5.2-alpha.d2c36ee7", | ||
"description": "turf tin module", | ||
@@ -29,4 +29,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@turf/helpers": "^3.3.3" | ||
"@turf/helpers": "^3.5.2-alpha.d2c36ee7" | ||
} | ||
} |
@@ -46,2 +46,6 @@ # @turf/tin | ||
<!-- This file is automatically generated. Please don't edit it directly: | ||
if you find an error, edit the source file (likely index.js), and re-run | ||
./scripts/generate-readmes in the turf project. --> | ||
--- | ||
@@ -48,0 +52,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
12476
246
70
1
1