Skip to content

Commit

Permalink
accept the large triangle
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil committed Sep 2, 2019
1 parent df46d12 commit de77a8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/voronoi.js
Expand Up @@ -107,7 +107,7 @@ export function geoVoronoi(data) {
tri.center = v.delaunay.centers[index];
return tri;
})
.filter(tri => excess(tri) > 0)
//.filter(tri => excess(tri) > 0)
.map(tri => ({
type: "Feature",
properties: {
Expand Down
7 changes: 4 additions & 3 deletions test/geo-voronoi-test.js
Expand Up @@ -114,7 +114,7 @@ tape("geoVoronoi.links(sites) returns links.", function(test) {
tape("geoVoronoi.triangles(sites) returns geojson.", function(test) {
const tri = geoVoronoi.geoVoronoi().triangles(sites);
test.equal(tri.type, "FeatureCollection");
test.equal(tri.features.length, 1);
test.equal(tri.features.length, 2);
test.end();
});

Expand All @@ -124,8 +124,9 @@ tape("geoVoronoi.links(sites) returns urquhart graph.", function(test) {
});

tape("geoVoronoi.triangles(sites) returns circumcenters.", function(test) {
var u = geoVoronoi.geoVoronoi().triangles(sites).features[0].properties.circumcenter, v = [ 5, 4.981069 ];
test.ok( (Math.abs(u[0]-v[0]) < 1e-6) && (Math.abs(u[1]-v[1]) < 1e-6) );
var u = geoVoronoi.geoVoronoi().triangles(sites).features[0].properties.circumcenter, v = [ 5, 4.981069 ], w = [ -180 + v[0], -v[1] ];
test.ok( (Math.abs(u[0]-v[0]) < 1e-6 && Math.abs(u[1]-v[1]) < 1e-6)
|| (Math.abs(u[0]-w[0]) < 1e-6 && Math.abs(u[1]-w[1]) < 1e-6) );
test.end();
});

Expand Down

0 comments on commit de77a8d

Please sign in to comment.