Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated vertex in output Voronoi polygons #83

Closed
jheer opened this issue Aug 22, 2019 · 3 comments · Fixed by #84
Closed

Duplicated vertex in output Voronoi polygons #83

jheer opened this issue Aug 22, 2019 · 3 comments · Fixed by #84
Labels
bug Something isn't working

Comments

@jheer
Copy link
Member

jheer commented Aug 22, 2019

At least for the case of two input points, the returned cell polygons may duplicate the start/end-point vertex.

const points = [[10, 10], [20, 10]];
const delaunay = Delaunay.from(points);
const voronoi = d.voronoi([0, 0, 30, 20]);
console.log(voronoi.cellPolygon(0).join(' -> '));
// 15,20 -> 0,20 -> 0,0 -> 15,0 -> 15,20 -> 15,20
@mbostock
Copy link
Member

Related #42?

@mourner mourner added the bug Something isn't working label Aug 22, 2019
@Fil
Copy link
Member

Fil commented Aug 22, 2019

Duplication is not detected when it happens with the first and last points.
4c2a05f#diff-2de452b04d4af7398be755b8afb55fb2R105

Not sure how to write this efficiently… not calling closePath() maybe if last===first?

@Fil
Copy link
Member

Fil commented Aug 22, 2019

not calling closePath() maybe if last===first?

Doing so works, but it is not so satisfying when you see the SVG path that just doesn't end with Z.
I propose instead #84

Fil added a commit that referenced this issue Aug 22, 2019
@Fil Fil closed this as completed in #84 Aug 24, 2019
Fil added a commit that referenced this issue Aug 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

4 participants